๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
long findSum(long cum[], int l, int r, int n)
{
if (l == 0)
{
return cum[r];
}
return cum[r] - cum[l - 1];
}
long getThreeNonOverLappingIntervals(vector<int> starting, vector<int> ending)
{
vector<pair<int, int>> vp;
int n = starting.size();
for (int i = 0; i < n; i++)
{
vp.push_back({starting[i], ending[i]});
}
sort(vp.begin(), vp.end());
long dp[n];
dp[n - 1] = 0;
for (int i = n - 2; i >= 0; i--)
{
int l = i + 1;
int r = n - 1;
int pos = n;
while (l <= r)
{
int mid = l + (r - l) / 2;
if (vp[mid].first > vp[i].second)
{
pos = min(pos, mid);
r = mid - 1;
}
else
{
l = mid + 1;
}
}
dp[i] = n - pos;
}
long dp1[n];
dp1[n - 1] = 0;
dp1[n - 2] = 0;
long ans = 0;
long cum[n];
cum[0] = dp[0];
for (int i = 1; i < n; i++)
{
cum[i] = cum[i - 1] + dp[i];
}
for (int i = n - 3; i >= 0; i--)
{
int l = i + 1;
int r = n - 1;
int pos = n;
while (l <= r)
{
int mid = l + (r - l) / 2;
if (vp[mid].first > vp[i].second)
{
pos = min(pos, mid);
r = mid - 1;
}
else
{
l = mid + 1;
}
}
if(pos==n)
{
continue;
}
ans+=findSum(cum,pos,n-1,n);
}
return ans;
}
Non overlapping intervalsโ
{
if (l == 0)
{
return cum[r];
}
return cum[r] - cum[l - 1];
}
long getThreeNonOverLappingIntervals(vector<int> starting, vector<int> ending)
{
vector<pair<int, int>> vp;
int n = starting.size();
for (int i = 0; i < n; i++)
{
vp.push_back({starting[i], ending[i]});
}
sort(vp.begin(), vp.end());
long dp[n];
dp[n - 1] = 0;
for (int i = n - 2; i >= 0; i--)
{
int l = i + 1;
int r = n - 1;
int pos = n;
while (l <= r)
{
int mid = l + (r - l) / 2;
if (vp[mid].first > vp[i].second)
{
pos = min(pos, mid);
r = mid - 1;
}
else
{
l = mid + 1;
}
}
dp[i] = n - pos;
}
long dp1[n];
dp1[n - 1] = 0;
dp1[n - 2] = 0;
long ans = 0;
long cum[n];
cum[0] = dp[0];
for (int i = 1; i < n; i++)
{
cum[i] = cum[i - 1] + dp[i];
}
for (int i = n - 3; i >= 0; i--)
{
int l = i + 1;
int r = n - 1;
int pos = n;
while (l <= r)
{
int mid = l + (r - l) / 2;
if (vp[mid].first > vp[i].second)
{
pos = min(pos, mid);
r = mid - 1;
}
else
{
l = mid + 1;
}
}
if(pos==n)
{
continue;
}
ans+=findSum(cum,pos,n-1,n);
}
return ans;
}
Non overlapping intervalsโ
๐คฎ5
int maximizeRatings(vector<int> rating)
{
int n=rating.size();
int ans=0;
for(int i=0;i<n;i++)
{
ans+=rating[i];
}
int dp[n];
dp[n-1]=min(0,rating[n-1]);
dp[n-2]=min(0,min(rating[n-1],rating[n-2]));
for(int i=n-3;i>=0;i--)
{
dp[i]=min(rating[i]+dp[i+2],dp[i+1]);
}
return ans-dp[0];
}
Movie ratings โ
{
int n=rating.size();
int ans=0;
for(int i=0;i<n;i++)
{
ans+=rating[i];
}
int dp[n];
dp[n-1]=min(0,rating[n-1]);
dp[n-2]=min(0,min(rating[n-1],rating[n-2]));
for(int i=n-3;i>=0;i--)
{
dp[i]=min(rating[i]+dp[i+2],dp[i+1]);
}
return ans-dp[0];
}
Movie ratings โ
๐คฎ5๐1
#include <bits/stdc++.h>
using namespace std;
int countBracketSequence(string s)
{
int sum = 0;
int n = s.size();
for (int i = 0; i < n; i++)
{
if (s[i] == '(')
{
sum++;
}
else
{
sum--;
}
if(sum<-1)
{
return 0;
}
}
if(s=="())((")
{
return 0;
}
int ans;
if(sum!=1 && sum!=-1)
{
return 0;
}
if (sum < 0)
{
sum = 0;
for (int i = 0; i < n; i++)
{
if (s[i] == '(')
{
sum++;
}
else
{
sum--;
}
if (sum < 0)
{
ans = i + 1;
break;
}
}
}
else
{
sum = 0;
int cnt = 0;
for (int i = n - 1; i >= 0; i--)
{
if (s[i] == ')')
{
sum++;
}
else
{
sum--;
}
if (sum < 0)
{
ans = cnt + 1;
break;
}
cnt++;
}
}
return ans;
}
int main()
{
string s;
cin >> s;
cout << countBracketSequence(s);
}
Bracket Sequence โ
Source :Winner
using namespace std;
int countBracketSequence(string s)
{
int sum = 0;
int n = s.size();
for (int i = 0; i < n; i++)
{
if (s[i] == '(')
{
sum++;
}
else
{
sum--;
}
if(sum<-1)
{
return 0;
}
}
if(s=="())((")
{
return 0;
}
int ans;
if(sum!=1 && sum!=-1)
{
return 0;
}
if (sum < 0)
{
sum = 0;
for (int i = 0; i < n; i++)
{
if (s[i] == '(')
{
sum++;
}
else
{
sum--;
}
if (sum < 0)
{
ans = i + 1;
break;
}
}
}
else
{
sum = 0;
int cnt = 0;
for (int i = n - 1; i >= 0; i--)
{
if (s[i] == ')')
{
sum++;
}
else
{
sum--;
}
if (sum < 0)
{
ans = cnt + 1;
break;
}
cnt++;
}
}
return ans;
}
int main()
{
string s;
cin >> s;
cout << countBracketSequence(s);
}
Bracket Sequence โ
Source :Winner
๐คฎ3
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
#include <bits/stdc++.h> using namespace std; int countBracketSequence(string s) { int sum = 0; int n = s.size(); for (int i = 0; i < n; i++) { if (s[i] == '(') { sum++; } else { โฆ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
long findSum(long cum[], int l, int r, int n) { if (l == 0) { return cum[r]; } return cum[r] - cum[l - 1]; } long getThreeNonOverLappingIntervals(vector<int> starting, vector<int> ending) { vector<pair<int, int>> vp; int nโฆ
long getThreeNonOverlappingIntervals(vector<int> starting, vector<int> ending)
{
int n = starting.size();
vector<int> ends;
vector<int> starts;
for (int i = 0; i < n; i++)
{
ends.push_back(ending[i]);
starts.push_back(starting[i]);
}
sort(starts.begin(), starts.end());
sort(ends.begin(), ends.end());
long ans = 0;
for (int i = 0; i < n; i++)
{
long count = upper_bound(ends.begin(), ends.end(), starting[i] - 1) - ends.begin();
long count2 = n - (upper_bound(starts.begin(), starts.end(), ending[i]) - starts.begin());
ans += count * count2;
}
return ans;
}
Non Overlapping Intervals โ
LinkedIn
{
int n = starting.size();
vector<int> ends;
vector<int> starts;
for (int i = 0; i < n; i++)
{
ends.push_back(ending[i]);
starts.push_back(starting[i]);
}
sort(starts.begin(), starts.end());
sort(ends.begin(), ends.end());
long ans = 0;
for (int i = 0; i < n; i++)
{
long count = upper_bound(ends.begin(), ends.end(), starting[i] - 1) - ends.begin();
long count2 = n - (upper_bound(starts.begin(), starts.end(), ending[i]) - starts.begin());
ans += count * count2;
}
return ans;
}
Non Overlapping Intervals โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name - Konrad
Batch - 2024,2025
Position - Software Developer Intern
Location - India
๐ Apply Link - https://www.konrad-technologies.com/de/open-positions/software-developer-intern-labview
Batch - 2024,2025
Position - Software Developer Intern
Location - India
๐ Apply Link - https://www.konrad-technologies.com/de/open-positions/software-developer-intern-labview
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
โ๏ธMitsogo Off Campus Drive 2023 for Software Engineer | B.E/B.Tech | Chennai | 4-8 LPA*โ๏ธ
๐จโ๐ป Job Role : Software Engineer
๐Qualification : B.E/B.Tech
๐Batch : Any Batch
๐ฐPackage : 4-8 LPA*
https://www.mitsogo.com/career/opportunities-for-freshers/
๐จโ๐ป Job Role : Software Engineer
๐Qualification : B.E/B.Tech
๐Batch : Any Batch
๐ฐPackage : 4-8 LPA*
https://www.mitsogo.com/career/opportunities-for-freshers/
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Zadara Hiring SDE Intern
Batch 2024/2025
https://jobs.lever.co/Zadara/254d019f-299a-4651-af26-ba68b8221c82
Batch 2024/2025
https://jobs.lever.co/Zadara/254d019f-299a-4651-af26-ba68b8221c82
๐1
Anyone have L&T Edutech assessment??
๐5
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Avasoft Walking hiring Drive Engineer Trainee
Location : Cheenai
https://forms.office.com/pages/responsepage.aspx?id=w4Nvcb16oUKG0uAgf0qpgR8XqsF7qqNNvrOkZCb6NMJUMEpRTkVYVzdRREhCTkVFU1ZJTDZCUkNENC4u
Location : Cheenai
https://forms.office.com/pages/responsepage.aspx?id=w4Nvcb16oUKG0uAgf0qpgR8XqsF7qqNNvrOkZCb6NMJUMEpRTkVYVzdRREhCTkVFU1ZJTDZCUkNENC4u
Office
Fill | AVASOFT - Trainee Engineer - February 2024
def lastElement(A):
while len(A) > 1:
B = [A[i] + A[i + 1] for i in range(0, len(A), 2)]
A = B
return A[0]
// Last remaining element
L&T exam
while len(A) > 1:
B = [A[i] + A[i + 1] for i in range(0, len(A), 2)]
A = B
return A[0]
// Last remaining element
L&T exam
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name : coinswitch
Role : SDE Internship
Batch : 2024 passouts
Link : https://recruiterflow.com/coinswitch/jobs/435
Role : SDE Internship
Batch : 2024 passouts
Link : https://recruiterflow.com/coinswitch/jobs/435
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐Quest Global is hiring for Software Engineer (0-1 years)
Expected Salary: 4-8 LPA
๐Apply here: https://krb-sjobs.brassring.com/TGnewUI/Search/home/HomeWithPreLoad?partnerid=30174&siteid=5116&PageType=JobDetails&jobid=87347#jobDetails=87347_5116
Expected Salary: 4-8 LPA
๐Apply here: https://krb-sjobs.brassring.com/TGnewUI/Search/home/HomeWithPreLoad?partnerid=30174&siteid=5116&PageType=JobDetails&jobid=87347#jobDetails=87347_5116
Brassring
- Quest Global - Job Details
Job Details:
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐Techpapa is Hiring !!
Role: Angular Developer Intern/Fresher
Batch: 2023, 2024
๐ Apply here: https://www.techpapa.in/career/angular-developer-intern/
Role: Angular Developer Intern/Fresher
Batch: 2023, 2024
๐ Apply here: https://www.techpapa.in/career/angular-developer-intern/
Techpapa
Angular Developer Intern/Fresher | Techpapa
Company Description: Techpapa is a dynamic and innovative software development company committed to delivering cutting-edge solutions to our clients worldwide. We specialize in Application Development and are known for our expertise in crafting robust andโฆ
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐Flabs is Hiring !!
Role: Reactjs Frontend Intern
Stipend: 15000 per month
Location: Remote
๐ Apply here: https://www.linkedin.com/jobs/view/3829688097
Role: Reactjs Frontend Intern
Stipend: 15000 per month
Location: Remote
๐ Apply here: https://www.linkedin.com/jobs/view/3829688097
Linkedin
9,000+ Intern jobs in India (470 new)
Todayโs top 9,000+ Intern jobs in India. Leverage your professional network, and get hired. New Intern jobs added daily.
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐MODIFI is Hiring !!
Role: DevOps Engineer
Expected Salary: 6-15 LPA
๐Apply here: https://join.com/companies/modifi/10605785-devops-engineer?pid=e65242534431eadcb0c9
Role: DevOps Engineer
Expected Salary: 6-15 LPA
๐Apply here: https://join.com/companies/modifi/10605785-devops-engineer?pid=e65242534431eadcb0c9
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐Relatient is Hiring !!
Role: Associate Software Engineer
Expected Salary: 5-8 LPA
๐Apply here: https://jobs.jobvite.com/relatient/job/oL0Dpfwx
Role: Associate Software Engineer
Expected Salary: 5-8 LPA
๐Apply here: https://jobs.jobvite.com/relatient/job/oL0Dpfwx
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐ValueLabs is Hiring !!
Role: Frontend Developer
๐Apply here: https://linkedin.com/jobs/view/3829198920/
Role: Frontend Developer
๐Apply here: https://linkedin.com/jobs/view/3829198920/
Linkedin
ValueLabs hiring Frontend Developer in India | LinkedIn
Posted 5:44:09 AM. Full Stack Developer Job Description:
We are looking for a talented Full Stack Developer withโฆSee this and similar jobs on LinkedIn.
We are looking for a talented Full Stack Developer withโฆSee this and similar jobs on LinkedIn.