#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int solution(vector<int>& A, vector<int>& B, int X, int Y) {
int N = A.size();
vector<int> dpA(N), dpB(N);
// Initial condition: Start at position 0 on either line
dpA[0] = A[0];
dpB[0] = B[0];
// Fill the dp arrays
for (int i = 1; i < N; ++i) {
dpA[i] = min(dpA[i - 1] + A[i], dpB[i - 1] + Y + A[i]);
dpB[i] = min(dpB[i - 1] + B[i], dpA[i - 1] + X + B[i]);
}
// The result is the minimum time to complete the car on either line at the last position
return min(dpA[N - 1], dpB[N - 1]);
}
int main() {
int N, X, Y;
cin >> N >> X >> Y;
vector<int> A(N), B(N);
for (int i = 0; i < N; ++i) {
cin >> A[i];
}
for (int i = 0; i < N; ++i) {
cin >> B[i];
}
cout << solution(A, B, X, Y) << endl;
return 0;
}
Ms task2โ
#include <vector>
#include <algorithm>
using namespace std;
int solution(vector<int>& A, vector<int>& B, int X, int Y) {
int N = A.size();
vector<int> dpA(N), dpB(N);
// Initial condition: Start at position 0 on either line
dpA[0] = A[0];
dpB[0] = B[0];
// Fill the dp arrays
for (int i = 1; i < N; ++i) {
dpA[i] = min(dpA[i - 1] + A[i], dpB[i - 1] + Y + A[i]);
dpB[i] = min(dpB[i - 1] + B[i], dpA[i - 1] + X + B[i]);
}
// The result is the minimum time to complete the car on either line at the last position
return min(dpA[N - 1], dpB[N - 1]);
}
int main() {
int N, X, Y;
cin >> N >> X >> Y;
vector<int> A(N), B(N);
for (int i = 0; i < N; ++i) {
cin >> A[i];
}
for (int i = 0; i < N; ++i) {
cin >> B[i];
}
cout << solution(A, B, X, Y) << endl;
return 0;
}
Ms task2โ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll solve(vector<int>& s, int k) {
sort(s.begin(), s.end());
int n = s.size();
vector<ll> ps(n+1, 0);
for (int i = 0; i < n; ++i) {
ps[i + 1] = ps[i] + s[i];
}
ll minEff = LLONG_MAX;
for (int i = 0; i <= n - k; ++i) {
int mIdx = i + k / 2;
int x = s[mIdx];
ll lSum = (mIdx - i) * x - (ps[mIdx] - ps[i]);
// cout << lSum <<" ";
ll rSum = (ps[i + k] - ps[mIdx + 1]) - (i + k - mIdx - 1) * x;
// cout << rSum <<" ";
ll eff = lSum + rSum;
minEff = min(minEff, eff);
}
return minEff;
}
Atlassian
findminimumeffortโ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
takeUforward | SWE Interns and FTE
https://www.linkedin.com/posts/takeuforward_hiring-wearehiring-activity-7228273874994442240-Fd3c
https://www.linkedin.com/posts/takeuforward_hiring-wearehiring-activity-7228273874994442240-Fd3c
Linkedin
๐จ WE ARE HIRING! | takeUforward
๐จ WE ARE HIRING!
We are looking for a SWE Intern and FTE. All the details mentioned in below forms. Might be closing this anytime soon!
Intern : https://lnkd.in/gJuWkEwr
FTE : https://lnkd.in/g3mRT2yx
#hiring | #wearehiring | 147 comments on LinkedIn
We are looking for a SWE Intern and FTE. All the details mentioned in below forms. Might be closing this anytime soon!
Intern : https://lnkd.in/gJuWkEwr
FTE : https://lnkd.in/g3mRT2yx
#hiring | #wearehiring | 147 comments on LinkedIn
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
MX is hiring Front-end Developer
For 2021, 2022 grads
Location: Chennai
https://mx.wd1.myworkdayjobs.com/MX-IND/job/Chennai-Tamil-Nadu-India/Software-Engineer---Frontend-Developer-Experience_R1517?source=LinkedIn
For 2021, 2022 grads
Location: Chennai
https://mx.wd1.myworkdayjobs.com/MX-IND/job/Chennai-Tamil-Nadu-India/Software-Engineer---Frontend-Developer-Experience_R1517?source=LinkedIn
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Full the Form: https://forms.gle/7mSaBWyMme7XGzW76
OR
Send your updated resume to: parnavi.srivastava@yendigital.com
OR
Send your updated resume to: parnavi.srivastava@yendigital.com
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐Vertex Infosoft Solutions Pvt. Ltd is urgently looking for B.tech (CS/IT) candidates with:
Excellent english communication skills ๐ฃ๏ธ for the 'Associate Engineer' position in the Technical Support department.
Interested candidates can share their CVs ๐at
careers@vertexinfosoft.com
Excellent english communication skills ๐ฃ๏ธ for the 'Associate Engineer' position in the Technical Support department.
Interested candidates can share their CVs ๐at
careers@vertexinfosoft.com
def is_valid_expression(s):
valid_chars = set("0123456789+-*/ ")
if any(c not in valid_chars for c in s):
return False
prev_char = ''
for i, c in enumerate(s.strip()):
if c in '+-*/':
if prev_char in '+-*/' or i == 0 or i == len(s.strip()) - 1:
return False
prev_char = c
return True
def evaluate_expression(s):
try:
result = eval(s)
if isinstance(result, int):
return result
else:
return -1
except ZeroDivisionError:
return -1
except Exception:
return -1
def integer_calculator(s):
s = s.strip()
if not is_valid_expression(s):
return -1
result = evaluate_expression(s)
return result
Jaguar โ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <bits/stdc++.h>
using namespace std;
struct node {
int h[26];
int n;
}
node null;
vector<node> trie;
void addContact(string &name) {
int act = 0;
for (char c : name) {
int p = c - 'a';
if (!trie[act].h[p]) {
trie[act].h[p] = trie.size();
trie.push_back(null);
}
act = trie[act].h[p];
trie[act].n++;
}
}
int findPartial(string &prefix) {
int act = 0;
for (char c : prefix) {
int p = c - 'a';
if (!trie[act].h[p]) return 0;
act = trie[act].h[p];
}
return trie[act].n;
}
int main() {
int n;
cin >> n;
string operation, contact;
null.n = 0;
for (int i = 0; i < 26; i++) null.h[i] = 0;
trie.push_back(null);
vector<int> results;
for (int i = 0; i < n; i++) {
cin >> operation >> contact;
if (operation == "add") {
addContact(contact);
} else if (operation == "find") {
results.push_back(findPartial(contact));
}
}
for (int res : results) {
cout << res << "\n";
}
return 0;
}
Jaguar โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Linkedin
Hiring Alert! | Ketan Goel | 78 comments
Hiring Alert!
Pocket FM FM are looking for a Data Analyst to join our team. We welcome freshers or candidates with 1-2 years of experience.
More such job updates: https://lnkd.in/gHxa8pHQ
You should apply if:
- You have a natural eye for data.
- Youโฆ
Pocket FM FM are looking for a Data Analyst to join our team. We welcome freshers or candidates with 1-2 years of experience.
More such job updates: https://lnkd.in/gHxa8pHQ
You should apply if:
- You have a natural eye for data.
- Youโฆ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
O(log n) labs hiring Frontend Developer ( SDE l )
3 - 6 LPA
Apply Here : https://wellfound.com/jobs/3076985-frontend-developer-sde-1
3 - 6 LPA
Apply Here : https://wellfound.com/jobs/3076985-frontend-developer-sde-1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
โ๏ธRoblox Off Campus Drive 2024 | Software Engineer - New Graduate | Rs. 1.26 Croreโ๏ธ
๐จโ๐ป Job Role : Software Engineer
๐Qualification : B.E/B.Tech
๐Batch : New Graduate
๐ฐSalary : Rs. 1.26 Crore
https://careers.roblox.com/jobs/6086753?gh_jid=6086753&gh_src=71e9c9571us
๐จโ๐ป Job Role : Software Engineer
๐Qualification : B.E/B.Tech
๐Batch : New Graduate
๐ฐSalary : Rs. 1.26 Crore
https://careers.roblox.com/jobs/6086753?gh_jid=6086753&gh_src=71e9c9571us
Roblox Careers
Careers Homepage
We are building the future of human connection and communication. Learn more about our culture, teams and view all open jobs.
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Frontend required for a specific task
To develop a single landing page for product based company
Dm him with the best piece of work
@kalihaxor
To develop a single landing page for product based company
Dm him with the best piece of work
@kalihaxor
โค1
#include <iostream>
#include <vector>
using namespace std;
vector<int> frequencyOfMaxValue(vector<int>& numbers, vector<int>& queries) {
int n = numbers.size();
vector<int> answer(n, -1);
int maxvalue = -1;
int count = 1;
for (int i = n - 1; i >= 0; --i) {
if (numbers[i] == maxvalue) {
count++;
} else if (numbers[i] > maxvalue) {
maxvalue = numbers[i];
count = 1;
}
answer[i] = count;
}
vector<int> result;
for (int index : queries) {
result.push_back(answer[index - 1]);
}
return result;
}
Frequency ofMaxValue
Wells fargoโ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <bits/stdc++.h>
using namespace std;
vector<int> getPopularityOrder(vector<vector<int>> song_preferences) {
int n = song_preferences[0].size();
vector<vector<int>> boxScore(n, vector<int>(n, 0));
for (const vector<int>& pref : song_preferences) {
for (int i = 0; i < pref.size() - 1; i++) {
for (int j = i + 1; j < pref.size(); j++) {
boxScore[pref[i]][pref[j]] += 1;
}
}
}
vector<array<int, 2>> wins(n, {0, 0});
for (int i = 0; i < n; i++) {
wins[i][0] = i;
for (int j = i + 1; j < n; j++) {
int score = boxScore[i][j] - boxScore[j][i];
if (score >= 0) {
wins[i][1]++;
} else {
wins[j][1]++;
}
}
}
sort(wins.begin(), wins.end(), [](const array<int, 2>& a, const array<int, 2>& b) {
if (a[1] == b[1]) {
return a[0] < b[0];
} else {
return b[1] < a[1];
}
});
vector<int> result;
for (const auto& win : wins) {
result.emplace_back(win[0]);
}
return result;
}
Songs Popularity
Wells Fargo โ