#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll solve(vector<ll>&a,vector<ll>&b,ll n,ll m)
{
ll ans=0;
ll s1=0,s2=0;
ll i=0,j=0;
while(i<n and j<m)
{
if(a[i]<b[j]) s1+=a[i++];
else if(a[i]>b[j]) s2+=b[j++];
else
{
ans+=max(s1,s2)+a[i];
i++;
j++;
s1=0;
s2=0;
}
}
while(i<n) s1+=a[i++];
while(j<m) s2+=b[j++];
return max(s1,s2)+ans;
}
signed main()
{
ll n; cin>>n;
vector<ll>a(n);
for(ll i=0;i<n;i++) cin>>a[i];
ll m; cin>>m;
vector<ll>b(m);
for(ll i=0;i<n;i++) cin>>b[i];
cout<<solve(a,b,n,m);
}
Cave coin collection โ
Intuit
#define ll long long
using namespace std;
ll solve(vector<ll>&a,vector<ll>&b,ll n,ll m)
{
ll ans=0;
ll s1=0,s2=0;
ll i=0,j=0;
while(i<n and j<m)
{
if(a[i]<b[j]) s1+=a[i++];
else if(a[i]>b[j]) s2+=b[j++];
else
{
ans+=max(s1,s2)+a[i];
i++;
j++;
s1=0;
s2=0;
}
}
while(i<n) s1+=a[i++];
while(j<m) s2+=b[j++];
return max(s1,s2)+ans;
}
signed main()
{
ll n; cin>>n;
vector<ll>a(n);
for(ll i=0;i<n;i++) cin>>a[i];
ll m; cin>>m;
vector<ll>b(m);
for(ll i=0;i<n;i++) cin>>b[i];
cout<<solve(a,b,n,m);
}
Cave coin collection โ
Intuit
#include <bits/stdc++.h>The Chemist
#include <bits/stdc++.h>
using namespace std;
int main() {
int k;
cin >> k;
int n;
cin >> n;
vector<int> arr(n);
for (int i = 0; i < n; i++) cin >> arr[i];
sort(arr.begin(), arr.end());
int min_diff = 1e9;
int best_sum = -1;
for (int i = 0; i < n; i++) {
int first = arr[i];
int lb = lower_bound(arr.begin() + i + 1, arr.end(), first + k) - arr.begin();
for (int j = lb - 1; j <= lb; j++) {
if (j > i && j < n) {
int second = arr[j];
int diff = abs(k - (second - first));
int sum = first + second;
if (diff < min_diff || (diff == min_diff && sum > best_sum)) {
min_diff = diff;
best_sum = sum;
}
}
}
}
cout << best_sum << endl;
return 0;
}
Uber โ
๐ฅ1
#include <bits/stdc++.h>>
using namespace std;
const int MOD = 10000;
int countArrays(string &S, int C, int K) {
int N = S.length();
vector<int> dp(N + 1, 0);
dp[0] = 1;
for (int i = 1; i <= N; i++) {
for (int j = 1; j <= K && j <= i; j++) {
string num_str = S.substr(i - j, j);
long long num = stoll(num_str);
if (num <= C) {
dp[i] = (dp[i] + dp[i - j]) % MOD;
}
}
}
return dp[N];
}
int main() {
int N, C, K;
cin >> N >> C >> K;
string S;
cin >> S;
cout << countArrays(S, C, K) << endl;
return 0;
}
Without whitespaces
Uber โ
๐ฅ1๐1
#include <bits/stdc++.h>
using namespace std;
bool chkValid(const vector<string>& eq, unordered_map<char, int>& l2d) {
vector<long long> nums;
for (const string& p : eq) {
long long num = 0;
for (char c : p) {
num = num * 10 + l2d[c];
}
nums.push_back(num);
}
return nums[0] + nums[1] == nums[2];
}
int dfs(vector<string>& eq, unordered_map<char, int>& l2d, unordered_set<int>& tD, vector<char>& let, int pos) {
if (pos == let.size()) {
return chkValid(eq, l2d) ? 1 : 0;
}
char l = let[pos];
int count = 0;
for (int d = 0; d < 10; ++d) {
if (tD.count(d)) continue;
if (d == 0 && find_if(eq.begin(), eq.end(), [&](string& p) { return p[0] == l; }) != eq.end()) continue;
tD.insert(d);
l2d[l] = d;
count += dfs(eq, l2d, tD, let, pos + 1);
tD.erase(d);
l2d.erase(l);
}
return count;
}
int cntCryptarithmSolutions(vector<string> eq) {
unordered_set<char> allLet;
for (const string& p : eq) {
for (char c : p) {
allLet.insert(c);
}
}
vector<char> let(allLet.begin(), allLet.end());
unordered_map<char, int> l2d;
unordered_set<int> tD;
return dfs(eq, l2d, tD, let, 0);
}
Crypt
Trilogy โ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
#include <bits/stdc++.h> using namespace std; bool chkValid(const vector<string>& eq, unordered_map<char, int>& l2d) { vector<long long> nums; for (const string& p : eq) { long long num = 0; for (char c : p) { num = numโฆ
โ
bool placeBlock(vector<vector<char>>& field, int row, int& finalRow, int& finalCol) {
int col = 0;
while (col < field[0].size() && field[row][col] == '.') ++col;
while (row < field.size() - 1 && field[row + 1][col] == '.') ++row;
if (col >= 0 && row >= 0) {
field[row][col] = '#';
finalRow = row;
finalCol = col;
return true;
}
return false;
}
void removeBlock(vector<vector<char>>& field, int row, int col) {
field[row][col] = '.';
}
void solve(vector<vector<char>>& field, vector<int>& ans, int cnt) {
bool check = true;
for (int i = 0; i < field.size(); ++i) {
if (field[i][0] != '#') {
check = false;
break;
}
}
if (check) {
ans[0] = min(ans[0], cnt);
ans[1] = max(ans[1], cnt);
return;
}
for (int i = 0; i < field.size(); ++i) {
int finalRow = -1, finalCol = -1;
if (placeBlock(field, i, finalRow, finalCol)) {
solve(field, ans, cnt + 1);
removeBlock(field, finalRow, finalCol);
}
}
}
vector<int> solution(vector<vector<char>> field) {
vector<int> ans = {INT_MAX, INT_MIN};
solve(field, ans, 0);
return ans;
}
Block placing
Trilogy โ
int col = 0;
while (col < field[0].size() && field[row][col] == '.') ++col;
while (row < field.size() - 1 && field[row + 1][col] == '.') ++row;
if (col >= 0 && row >= 0) {
field[row][col] = '#';
finalRow = row;
finalCol = col;
return true;
}
return false;
}
void removeBlock(vector<vector<char>>& field, int row, int col) {
field[row][col] = '.';
}
void solve(vector<vector<char>>& field, vector<int>& ans, int cnt) {
bool check = true;
for (int i = 0; i < field.size(); ++i) {
if (field[i][0] != '#') {
check = false;
break;
}
}
if (check) {
ans[0] = min(ans[0], cnt);
ans[1] = max(ans[1], cnt);
return;
}
for (int i = 0; i < field.size(); ++i) {
int finalRow = -1, finalCol = -1;
if (placeBlock(field, i, finalRow, finalCol)) {
solve(field, ans, cnt + 1);
removeBlock(field, finalRow, finalCol);
}
}
}
vector<int> solution(vector<vector<char>> field) {
vector<int> ans = {INT_MAX, INT_MIN};
solve(field, ans, 0);
return ans;
}
Block placing
Trilogy โ
๐2
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Maze Craze โ
#include <iostream>
#include <vector>
using namespace std;
const int MOD = 1e9 + 7;
int solve(int N, int M, vector<vector<int>>& nums) {
vector<vector<long long>> dp(N, vector<long long>(M, 0));
dp[0][0] = nums[0][0];
for (int j = 1; j < M; ++j) {
dp[0][j] = (dp[0][j - 1] * nums[0][j]) % MOD;
}
for (int i = 1; i < N; ++i) {
dp[i][0] = (dp[i - 1][0] * nums[i][0]) % MOD;
}
for (int i = 1; i < N; ++i) {
for (int j = 1; j < M; ++j) {
dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) * nums[i][j] % MOD;
}
}
return dp[N - 1][M - 1];
}
int main() {
int N, M;
cin >> N >> M;
vector<vector<int>> nums(N, vector<int>(M));
for (int i = 0; i < N; ++i) {
for (int j = 0; j < M; ++j) {
cin >> nums[i][j];
}
}
cout << solve(N, M, nums) << endl;
return 0;
}
Maze Crazeโ
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Take Home Assignment based Hiring
Sample Invoices for reference:
https://drive.google.com/drive/folders/1Q7sU_eiisOvtCAFCRSesyMDkVsMtNF7h?usp=drive_link
Sample Invoices for reference:
https://drive.google.com/drive/folders/1Q7sU_eiisOvtCAFCRSesyMDkVsMtNF7h?usp=drive_link
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐Volopay is hiring for Interns (for girls)
Expected Stipend: 20K - 30K per month
Apply for Frontend Developer Intern:
https://app.dover.com/apply/volopay/c6bc9f1a-87ae-4dff-9fa3-737a4ca8bc4a?rs=42706078
Apply for Backend Developer Intern:
https://app.dover.com/apply/volopay/97ec0199-c7f7-4607-860d-4130f9b6792a?rs=42706078
Expected Stipend: 20K - 30K per month
Apply for Frontend Developer Intern:
https://app.dover.com/apply/volopay/c6bc9f1a-87ae-4dff-9fa3-737a4ca8bc4a?rs=42706078
Apply for Backend Developer Intern:
https://app.dover.com/apply/volopay/97ec0199-c7f7-4607-860d-4130f9b6792a?rs=42706078
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐Yulu is hiring for Data Engineer (0-2 years)
Expected Salary: 10-20 LPA
Apply here:
https://linkedin.com/jobs/view/3997216785/?alternateChannel=search
Expected Salary: 10-20 LPA
Apply here:
https://linkedin.com/jobs/view/3997216785/?alternateChannel=search
Linkedin
Yulu hiring Data Engineer in Bengaluru, Karnataka, India | LinkedIn
Posted 6:36:30 AM. About Yulu:
As Indiaโs leading shared electric mobility technology player, Yulu is purposeful andโฆSee this and similar jobs on LinkedIn.
As Indiaโs leading shared electric mobility technology player, Yulu is purposeful andโฆSee this and similar jobs on LinkedIn.
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐Magnit is hiring for UIUX - Software Engineer
Expected Salary: 5-10 LPA
Apply here:
https://globaleur241.dayforcehcm.com/CandidatePortal/en-US/ProUnlimited/Posting/View/3235?src=LinkedIn
Expected Salary: 5-10 LPA
Apply here:
https://globaleur241.dayforcehcm.com/CandidatePortal/en-US/ProUnlimited/Posting/View/3235?src=LinkedIn
Dayforcehcm
Job opportunity at Magnit - UIUX - Software Engineer
Become a Part of our Growing Team!
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Enphase Energy is hiring for Engineer - UI / UX (0-3 years)
Expected Salary: 15-20 LPA
Apply here:
https://jobs.jobvite.com/enphase-energy/job/oZwCtfwk?jvst=Job%20Board&jvsd=LinkedIn
Expected Salary: 15-20 LPA
Apply here:
https://jobs.jobvite.com/enphase-energy/job/oZwCtfwk?jvst=Job%20Board&jvsd=LinkedIn
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐S&P is hiring for Software Developer (Intern)
Expected Stipend: 2-4 LPA
Apply here:
https://careers.spglobal.com/jobs/301859?lang=en-us
Expected Stipend: 2-4 LPA
Apply here:
https://careers.spglobal.com/jobs/301859?lang=en-us
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐BetterHalf is hiring for React Native Interns
Stipend: 50K-60K per month
Apply here:
https://linkedin.com/posts/poojasiingh_hiring-react-react-activity-7226904599117320192-8Wr2?utm_source=share&utm_medium=member_desktop
Stipend: 50K-60K per month
Apply here:
https://linkedin.com/posts/poojasiingh_hiring-react-react-activity-7226904599117320192-8Wr2?utm_source=share&utm_medium=member_desktop
Linkedin
Pooja Singh on LinkedIn: #hiring #react #react #hiring #internship #react #reactnative #startupโฆ | 50 comments
Hello Connections,
We are #hiring for #React and #React Native Interns.
Stipend- 50-60K (depending on the profile)
Location- Bangalore HSR(5 daysโฆ | 50 comments on LinkedIn
We are #hiring for #React and #React Native Interns.
Stipend- 50-60K (depending on the profile)
Location- Bangalore HSR(5 daysโฆ | 50 comments on LinkedIn
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Linkedin
Piyush Ranjan on LinkedIn: #hiring #insurtech | 26 comments
โจ Hiring alert! โจ
We're looking for exceptional Backend (Python+Django) and Frontend (React) Engineers to join our engineering team. Join us and get theโฆ | 26 comments on LinkedIn
We're looking for exceptional Backend (Python+Django) and Frontend (React) Engineers to join our engineering team. Join us and get theโฆ | 26 comments on LinkedIn