longest pallindromic subsequence Infosys
vector<int> solve(string s)
{
int l = S.length();
vector<int> lhs(l,0);
vector<int> rhs(l,0);
if(l<1)
return 0;
if(S[0] == '1')
lhs[0] = 1;
if(S[l-1] == '1')
rhs[l-1] = 1;
for(int i=1;i<l;i++)
{
if(S[i] == '1')
lhs[i] = lhs[i-1] + 1;
}
for(int i=l-2;i>=0;i--)
{
if(S[i] == '1')
rhs[i] = rhs[i+1] + 1;
}
int max_ = 0;
for(int i=K-1;i<l;i++)
{
int j = i - (K-1);
int ll = 0,rr = 0;
if(j-1 < 0)
ll = 0;
else
ll = lhs[j-1];
if(i+1>= l)
rr = 0;
else
rr = rhs[i+1];
if(max_ < (ll+rr+K))
max_ = (ll+rr+K);
}
return max_;
}
Vikings solution
{
int l = S.length();
vector<int> lhs(l,0);
vector<int> rhs(l,0);
if(l<1)
return 0;
if(S[0] == '1')
lhs[0] = 1;
if(S[l-1] == '1')
rhs[l-1] = 1;
for(int i=1;i<l;i++)
{
if(S[i] == '1')
lhs[i] = lhs[i-1] + 1;
}
for(int i=l-2;i>=0;i--)
{
if(S[i] == '1')
rhs[i] = rhs[i+1] + 1;
}
int max_ = 0;
for(int i=K-1;i<l;i++)
{
int j = i - (K-1);
int ll = 0,rr = 0;
if(j-1 < 0)
ll = 0;
else
ll = lhs[j-1];
if(i+1>= l)
rr = 0;
else
rr = rhs[i+1];
if(max_ < (ll+rr+K))
max_ = (ll+rr+K);
}
return max_;
}
Vikings solution
๐1
CalculatSumOfPrime
IBM โ
IBM โ
1st line is already given
๐1
Which feature of OOP is exhibited by the function overriding?
Anonymous Quiz
25%
Inheritance
14%
Abstraction
10%
Encapsulation
51%
Polymorphism
๐4
def numSubarrayProductLessThanK(self, nums, k):
prod = 1
ans = left = 0
right =0
while right<len(nums):
prod*=nums[right]
while left<=right and prod>=k:
prod/=nums[left]
left+=1
ans+=right-left+1
right+=1
return ans
prod = 1
ans = left = 0
right =0
while right<len(nums):
prod*=nums[right]
while left<=right and prod>=k:
prod/=nums[left]
left+=1
ans+=right-left+1
right+=1
return ans
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Samsung electronics is hiring for SDE / SDET role
Batch eligible: 2021 and 2022 passouts(B.E, B.Tech (Only CSE and IT))
๐7.5+ CGPA
๐ Location: Chennai
Interview is from office.
If all above criteria fulfilled, you can contact: 8122949536 (Suganya)
Batch eligible: 2021 and 2022 passouts(B.E, B.Tech (Only CSE and IT))
๐7.5+ CGPA
๐ Location: Chennai
Interview is from office.
If all above criteria fulfilled, you can contact: 8122949536 (Suganya)
๐1
โ๏ธBhavna Corp Driveโ๏ธ
๐ Batch - 2022 [BTech MCA]
๐ฐ CTC - 5.5LPA
๐ Link - firstnaukri.com/careers/customised/landingpage/bhavna-corp/index.html
๐ Batch - 2022 [BTech MCA]
๐ฐ CTC - 5.5LPA
๐ Link - firstnaukri.com/careers/customised/landingpage/bhavna-corp/index.html
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Not sure about CTC, but if you are interested send your resume at: dolly.rathi@softude.com
Reminderโจ
Just because it's hard , doesn't mean it's impossible.
U can do it ๐ป
Just because it's hard , doesn't mean it's impossible.
U can do it ๐ป
๐3