๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <bits/stdc++.h>
class WorkSchedule {
public:
static void findSchedulesHelper(int workHours, int dayHours, const std::string& pattern, int index, int sum, std::string& current, std::vector<std::string>& schedules) {
if (index == pattern.length()) {
if (sum == workHours) {
schedules.push_back(current);
}
return;
}
if (pattern[index] == '?') {
for (int i = 0; i <= dayHours; i++) {
current[index] = '0' + i;
findSchedulesHelper(workHours, dayHours, pattern, index + 1, sum + i, current, schedules);
}
current[index] = '?';
} else {
findSchedulesHelper(workHours, dayHours, pattern, index + 1, sum + (pattern[index] - '0'), current, schedules);
}
}
static std::vector<std::string> findSchedules(int workHours, int dayHours, const std::string& pattern) {
std::vector<std::string> schedules;
std::string current = pattern;
findSchedulesHelper(workHours, dayHours, pattern, 0, 0, current, schedules);
std::sort(schedules.begin(), schedules.end());
return schedules;
}
};
Work schedule โ
Agoda
class WorkSchedule {
public:
static void findSchedulesHelper(int workHours, int dayHours, const std::string& pattern, int index, int sum, std::string& current, std::vector<std::string>& schedules) {
if (index == pattern.length()) {
if (sum == workHours) {
schedules.push_back(current);
}
return;
}
if (pattern[index] == '?') {
for (int i = 0; i <= dayHours; i++) {
current[index] = '0' + i;
findSchedulesHelper(workHours, dayHours, pattern, index + 1, sum + i, current, schedules);
}
current[index] = '?';
} else {
findSchedulesHelper(workHours, dayHours, pattern, index + 1, sum + (pattern[index] - '0'), current, schedules);
}
}
static std::vector<std::string> findSchedules(int workHours, int dayHours, const std::string& pattern) {
std::vector<std::string> schedules;
std::string current = pattern;
findSchedulesHelper(workHours, dayHours, pattern, 0, 0, current, schedules);
std::sort(schedules.begin(), schedules.end());
return schedules;
}
};
Work schedule โ
Agoda
class UserMainCode:
@staticmethod
def indexSort(input1, input2):
uniq = set()
for i in range(input1):
if input2[i] != i + 1:
uniq.add(input2[i])
return input1 - len(uniq)
Index Sortโ
@staticmethod
def indexSort(input1, input2):
uniq = set()
for i in range(input1):
if input2[i] != i + 1:
uniq.add(input2[i])
return input1 - len(uniq)
Index Sortโ
long getMaxCost(string s) {
if (s.find('1') == string::npos) {
return 0;
}
int ind = s.find('1');
int count = 1;
int n = s.length();
long res = 0;
int prev = ind;
for (int i = ind + 1; i < n; ++i) {
if (s[i] == '1') {
if (prev != i - 1) {
res += (i - prev) * count;
}
count += 1;
prev = i;
}
}
if (prev == n - 1) {
prev = n;
}
return res + count * (n - prev);
}
Binary Circuit โ
if (s.find('1') == string::npos) {
return 0;
}
int ind = s.find('1');
int count = 1;
int n = s.length();
long res = 0;
int prev = ind;
for (int i = ind + 1; i < n; ++i) {
if (s[i] == '1') {
if (prev != i - 1) {
res += (i - prev) * count;
}
count += 1;
prev = i;
}
}
if (prev == n - 1) {
prev = n;
}
return res + count * (n - prev);
}
Binary Circuit โ
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
long findInterestingPairs(vector<int>& arr, int sumVal) {
sort(arr.begin(), arr.end());
int val = sumVal / 2;
long cc = 0;
int ind = -1;
for (int i = 0; i < arr.size(); ++i) {
if (arr[i] == val) {
cc++;
if (ind == -1) {
ind = i;
}
}
}
if (ind == -1) {
return 0;
}
return ind * cc + ((cc - 1) * cc) / 2;
}.
De shaw
Intersecting Pairsโ
#include <vector>
#include <algorithm>
using namespace std;
long findInterestingPairs(vector<int>& arr, int sumVal) {
sort(arr.begin(), arr.end());
int val = sumVal / 2;
long cc = 0;
int ind = -1;
for (int i = 0; i < arr.size(); ++i) {
if (arr[i] == val) {
cc++;
if (ind == -1) {
ind = i;
}
}
}
if (ind == -1) {
return 0;
}
return ind * cc + ((cc - 1) * cc) / 2;
}.
De shaw
Intersecting Pairsโ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: Accelya
๐ Job Title: SDE 1
โ๐ป YOE: 2022 and 2023 grads
โก๏ธ Apply: https://accelya.wd103.myworkdayjobs.com/en-US/Careers/job/Engineer-I---Software-Development_JR100382
Please do share in your college grps and in case you are applying please react on this post:) ๐โค๏ธ
๐ Job Title: SDE 1
โ๐ป YOE: 2022 and 2023 grads
โก๏ธ Apply: https://accelya.wd103.myworkdayjobs.com/en-US/Careers/job/Engineer-I---Software-Development_JR100382
Please do share in your college grps and in case you are applying please react on this post:) ๐โค๏ธ
Myworkdayjobs
Engineer I - Software Development
For more than 40 years, Accelya has been the industryโs partner for change, simplifying airline financial and commercial processes and empowering the air transport community to take better control of the future. Whether partnering with IATA on industry-wideโฆ
Two friends problem โ
Pass the baton โ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include<bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
vector<vector<vector<string>>> dp;
vector<string> solve(string& alice, string& bob, int i, int j) {
if(i == alice.size() || j == bob.size()) {
return {""};
}
if(dp[i][j].size() != 0) {
return dp[i][j];
}
if(alice[i] == bob[j]) {
vector<string> tmp = solve(alice, bob, i+1, j+1);
for(string& s : tmp) {
s = alice[i] + s;
}
return dp[i][j] = tmp;
}
vector<string> left = solve(alice, bob, i+1, j);
vector<string> right = solve(alice, bob, i, j+1);
if(left[0].size() > right[0].size()) {
return dp[i][j] = left;
}
if(left[0].size() < right[0].size()) {
return dp[i][j] = right;
}
left.insert(left.end(), right.begin(), right.end());
sort(left.begin(), left.end());
left.erase(unique(left.begin(), left.end()), left.end());
return dp[i][j] = left;
}
int main() {
int T;
cin >> T;
while(T--) {
string alice, bob;
cin >> alice >> bob;
dp = vector<vector<vector<string>>>(alice.size(), vector<vector<string>>(bob.size()));
vector<string> trips = solve(alice, bob, 0, 0);
for(string& trip : trips) {
cout << trip << endl;
}
}
return 0;
}
INFAthon 4.0โ
using namespace std;
const int MOD = 1e9 + 7;
vector<vector<vector<string>>> dp;
vector<string> solve(string& alice, string& bob, int i, int j) {
if(i == alice.size() || j == bob.size()) {
return {""};
}
if(dp[i][j].size() != 0) {
return dp[i][j];
}
if(alice[i] == bob[j]) {
vector<string> tmp = solve(alice, bob, i+1, j+1);
for(string& s : tmp) {
s = alice[i] + s;
}
return dp[i][j] = tmp;
}
vector<string> left = solve(alice, bob, i+1, j);
vector<string> right = solve(alice, bob, i, j+1);
if(left[0].size() > right[0].size()) {
return dp[i][j] = left;
}
if(left[0].size() < right[0].size()) {
return dp[i][j] = right;
}
left.insert(left.end(), right.begin(), right.end());
sort(left.begin(), left.end());
left.erase(unique(left.begin(), left.end()), left.end());
return dp[i][j] = left;
}
int main() {
int T;
cin >> T;
while(T--) {
string alice, bob;
cin >> alice >> bob;
dp = vector<vector<vector<string>>>(alice.size(), vector<vector<string>>(bob.size()));
vector<string> trips = solve(alice, bob, 0, 0);
for(string& trip : trips) {
cout << trip << endl;
}
}
return 0;
}
INFAthon 4.0โ
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
int maxSumOptimalArrangement(vector<int>& coins) {
vector<int> positive;
vector<int> negative;
for (int coin : coins) {
if (coin >= 0)
positive.push_back(coin);
else
negative.push_back(coin);
}
sort(positive.rbegin(), positive.rend());
sort(negative.begin(), negative.end());
int totalSum = 0;
for (size_t i = 0; i < max(positive.size(), negative.size()); ++i) {
if (i < positive.size())
totalSum += positive[i];
if (i < negative.size())
totalSum -= negative[i];
}
return totalSum;
}
};
ZS campus beat code question :
Circuit Board โ
#include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
int maxSumOptimalArrangement(vector<int>& coins) {
vector<int> positive;
vector<int> negative;
for (int coin : coins) {
if (coin >= 0)
positive.push_back(coin);
else
negative.push_back(coin);
}
sort(positive.rbegin(), positive.rend());
sort(negative.begin(), negative.end());
int totalSum = 0;
for (size_t i = 0; i < max(positive.size(), negative.size()); ++i) {
if (i < positive.size())
totalSum += positive[i];
if (i < negative.size())
totalSum -= negative[i];
}
return totalSum;
}
};
ZS campus beat code question :
Circuit Board โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Software Engineer (Fresher) at Bitcoin Devs Company
1 lakh/ month
https://www.linkedin.com/jobs/view/3906517701
1 lakh/ month
https://www.linkedin.com/jobs/view/3906517701
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Software Engineer Intern at CircoLife
Stipend:
35,000 - 50,000 per month (2/3 candidates required)
Duration of Internship :- 2 months
https://www.linkedin.com/jobs/view/3909114641
Stipend:
35,000 - 50,000 per month (2/3 candidates required)
Duration of Internship :- 2 months
https://www.linkedin.com/jobs/view/3909114641
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Meta (Earlier Facebook) hiring for 2024 Grads
NOTE: Apply with a referral
https://www.metacareers.com/jobs/7330400040375573/
NOTE: Apply with a referral
https://www.metacareers.com/jobs/7330400040375573/