๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
if(s.size()==0){ cnt--; continue; } Just add this, number of candies Google Girl Hackathon
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;
int maximum_candies(int n, int m, vector<vector<int>> gift) {
vector<multiset<int>> v(n+1);
for(int i=0; i<m; i++){
int d = gift[i][0];
int val = gift[i][1];
v[d].insert(val);
}
int ans = 0;
int cnt = n;
multiset<int> s;
for (int i=1; i<=n ; i++){
for (auto j:v[i]){
s.insert(j);
}
if(s.size()==0){
cnt--;
continue;
}
auto it=s.end();
it--;
int el=*it;
ans=(ans%mod +((el%mod)*(cnt%mod))%mod)%mod;
cnt--;
s.erase(it);
}
return ans%mod;
}
int main() {
int n, m;
cin >> n >> m;
vector<vector<int>> gift(m, vector<int>(2));
for(int i=0; i<m; i++){
cin >> gift[i][0] >> gift[i][1];
}
cout << maximum_candies(n, m, gift) << endl;
return 0;
}
Candle โ
using namespace std;
const int mod = 1e9+7;
int maximum_candies(int n, int m, vector<vector<int>> gift) {
vector<multiset<int>> v(n+1);
for(int i=0; i<m; i++){
int d = gift[i][0];
int val = gift[i][1];
v[d].insert(val);
}
int ans = 0;
int cnt = n;
multiset<int> s;
for (int i=1; i<=n ; i++){
for (auto j:v[i]){
s.insert(j);
}
if(s.size()==0){
cnt--;
continue;
}
auto it=s.end();
it--;
int el=*it;
ans=(ans%mod +((el%mod)*(cnt%mod))%mod)%mod;
cnt--;
s.erase(it);
}
return ans%mod;
}
int main() {
int n, m;
cin >> n >> m;
vector<vector<int>> gift(m, vector<int>(2));
for(int i=0; i<m; i++){
cin >> gift[i][0] >> gift[i][1];
}
cout << maximum_candies(n, m, gift) << endl;
return 0;
}
Candle โ
#include <bits/stdc++.h>
using namespace std;
int lcs(string A, string B ) {
int m = A.size(), n = B.size();
vector<vector<int>> dp(m + 1, vector<int>(n + 1, 0));
int maxLen = 0;
for (int i = 1; i <= m; ++i) {
for (int j = 1; j <= n; ++j) {
if (A[i - 1] == B[j - 1]) {
dp[i][j] = dp[i - 1][j - 1] + 1;
maxLen = max(maxLen, dp[i][j]);
}
}
}
return maxLen;
}
int solve(string A, string B ) {
int len = lcs(A, B);
return A.size() + B.size() - 2 * len;
}
int main() {
string A, B;
cin >> A >> B;
cout << solve(A, B ) << endl;
return 0;
}
Equal Stringsโ
Airbus
using namespace std;
int lcs(string A, string B ) {
int m = A.size(), n = B.size();
vector<vector<int>> dp(m + 1, vector<int>(n + 1, 0));
int maxLen = 0;
for (int i = 1; i <= m; ++i) {
for (int j = 1; j <= n; ++j) {
if (A[i - 1] == B[j - 1]) {
dp[i][j] = dp[i - 1][j - 1] + 1;
maxLen = max(maxLen, dp[i][j]);
}
}
}
return maxLen;
}
int solve(string A, string B ) {
int len = lcs(A, B);
return A.size() + B.size() - 2 * len;
}
int main() {
string A, B;
cin >> A >> B;
cout << solve(A, B ) << endl;
return 0;
}
Equal Stringsโ
Airbus
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Zoomcar is hiring for Interns for Data Science and Data Engineering teams.
Duration: 6 Months (paid internship)
Preferred Colleges: Tier 1 & Tier 2
Location: Bangalore (WFO)
If youโre an immediate joiner, please send your resume at soundarya.ds@zoomcar.com
Duration: 6 Months (paid internship)
Preferred Colleges: Tier 1 & Tier 2
Location: Bangalore (WFO)
If youโre an immediate joiner, please send your resume at soundarya.ds@zoomcar.com
ll solve(vector<int>& heights) {
int n = heights.size();
vector<ll> left(n), right(n, n);
stack<int> s;
for (int i = 0; i < n; ++i) {
while (!s.empty() && heights[s.top()] <= heights[i]) {
right[s.top()] = i;
s.pop();
}
left[i] = s.empty() ? -1 : s.top();
s.push(i);
}
ll tot = 0;
for (int i = 0; i < n; ++i) {
tot += (i - left[i]) + (right[i] - i) - 1;
}
return tot;
}
Calculate Region โ
int n = heights.size();
vector<ll> left(n), right(n, n);
stack<int> s;
for (int i = 0; i < n; ++i) {
while (!s.empty() && heights[s.top()] <= heights[i]) {
right[s.top()] = i;
s.pop();
}
left[i] = s.empty() ? -1 : s.top();
s.push(i);
}
ll tot = 0;
for (int i = 0; i < n; ++i) {
tot += (i - left[i]) + (right[i] - i) - 1;
}
return tot;
}
Calculate Region โ
๐1
De shaw building monuments โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐Appreciate is hiring for Junior Data Analyst
Location: Remote
๐Apply here:
https://linkedin.com/jobs/view/3903233108/
Location: Remote
๐Apply here:
https://linkedin.com/jobs/view/3903233108/
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐Brandintelle is hiring for ML Engineer Intern
๐Apply here:
https://brandintelle.com/careers/?jobId=Lf73S85rYp3b&ft_source=5000609540&ft_medium=5000545167
๐Apply here:
https://brandintelle.com/careers/?jobId=Lf73S85rYp3b&ft_source=5000609540&ft_medium=5000545167
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Software Engineer Carvis.AI
Remote Startup Hiring, Small team
Pay: 2K-5K$ per month
https://www.linkedin.com/jobs/view/3902835819
Remote Startup Hiring, Small team
Pay: 2K-5K$ per month
https://www.linkedin.com/jobs/view/3902835819
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐จJOB OPENING ALERT๐จ
Company โ Cerina Health
Role โ AI ML Engineer - Intern
Exp. โ Fresher
Apply Here โ https://www.linkedin.com/jobs/view/3902420120
Company โ NextGen Technologies
Role โ Data Scientist
Exp. โ Fresher
Apply Here โ https://www.linkedin.com/jobs/view/3903571754
Company โ Express Analytics India Pvt Ltd
Role โ Data Science Internship
Exp. โ Fresher
Apply Here โ https://internshala.com/internship/details/work-from-home-data-science-internship-at-express-analytics-india-pvt-ltd1713511795?utm_source=cp_link&referral=web_share
Company โ DEPLOYH.AI Technologies
Role โ Data Engineer Intern
Exp. โ 0-1 yr
Apply Here โ https://www.naukri.com/job-listings-data-engineer-intern-deployh-ai-technologies-private-limited-hyderabad-0-to-1-years-160424012587?src=jobsearchDesk&sid=17135123840742782_3&xp=1&px=1&nignbevent_src=jobsearchDeskGNB
Company โ Cerina Health
Role โ AI ML Engineer - Intern
Exp. โ Fresher
Apply Here โ https://www.linkedin.com/jobs/view/3902420120
Company โ NextGen Technologies
Role โ Data Scientist
Exp. โ Fresher
Apply Here โ https://www.linkedin.com/jobs/view/3903571754
Company โ Express Analytics India Pvt Ltd
Role โ Data Science Internship
Exp. โ Fresher
Apply Here โ https://internshala.com/internship/details/work-from-home-data-science-internship-at-express-analytics-india-pvt-ltd1713511795?utm_source=cp_link&referral=web_share
Company โ DEPLOYH.AI Technologies
Role โ Data Engineer Intern
Exp. โ 0-1 yr
Apply Here โ https://www.naukri.com/job-listings-data-engineer-intern-deployh-ai-technologies-private-limited-hyderabad-0-to-1-years-160424012587?src=jobsearchDesk&sid=17135123840742782_3&xp=1&px=1&nignbevent_src=jobsearchDeskGNB
Internshala
Data Science Work From Home Internship at Express Analytics India Pvt Ltd
About Us: Express Analytics is a leading data analytics company specializing in providing actionable insights to businesses worldwide. Our team of dedicated professionals leverages cutting-edge technology and innovative methodologies to deliver solutionsโฆ
๐2
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Cisco
graduated in 2023/2024 and obtained final degree completion certificate or Provisional Degree Certificate
https://jobs.cisco.com/jobs/ProjectDetail/Technical-Graduate-Apprentice-India-UHR/1420956
graduated in 2023/2024 and obtained final degree completion certificate or Provisional Degree Certificate
https://jobs.cisco.com/jobs/ProjectDetail/Technical-Graduate-Apprentice-India-UHR/1420956
#include<bits/stdc++.h>
#define ll long long
using namespace std;
vector<vector<ll>>adj[10000006];
ll solve(ll n)
{
vector<ll>vis(n,0);
priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<pair<ll,ll>>>pq;
vector<ll>dist(n,1e9);
dist[0]=0;
pq.push({0,0});
vis[0]=1;
while(!pq.empty()){
ll dis=pq.top().first;
ll node=pq.top().second;
vis[node]=1;
pq.pop();
for(auto it:adj[node]){
ll edw=it[1];
ll adjNode=it[0];
if(dis+edw<dist[adjNode]){
dist[adjNode]=dis+edw;
pq.push({dist[adjNode],adjNode});
}
}
}
ll res=dist[0];
for(ll i=0;i<n;i++)
{
res=max(res,dist[i]);
if(!vis[i])return -1;
}
return res;
}
signed main()
{
ll n,m; cin>>n>>m;
for(ll i=0;i<m;i++)
{
ll a,b,c; cin>>a>>b>>c;
a--;
b--;
adj[a].push_back({b,c});
}
cout<<solve(n);
return 0;
}
Network delay Time โ
#include <iostream>
#include <vector>
#include <stack>
using namespace std;
vector<int>solve(vector<int>& arr) {
vector<int>result;
stack<int>s;
for (int i=0;i<arr.size();i++)
{
while (!s.empty() && s.top() >= arr[i]) s.pop();
if (s.empty()) result.push_back(-1);
else result.push_back(s.top());
s.push(arr[i]);
}
return result;
}
int main() {
int n; cin>>n;
vector<int>arr(n);
for(int i=0;i<n;i++) cin>>arr[i];
vector<int>result=solve(arr);
for (auto it:result) cout<<it<<" ";
return 0;
}
Height Problem โ