public static int getTripletCount(List<Integer> a, int d) {
int T = 0;
HashMap<Integer, Integer> H = new HashMap<>();
for (int k = 2; k < a.size(); k++) {
int key = a.get(k) % d;
H.put(key, H.getOrDefault(key, 0) + 1);
}
for (int j = 1; j < a.size(); j++) {
if (j >= 2) {
H.put(a.get(j) % d, H.get(a.get(j) % d) - 1);
}
for (int i = 0; i < j; i++) {
int matchingVal = (d - (a.get(i) + a.get(j)) % d) % d;
int toAdd = H.getOrDefault(matchingVal, 0);
T += toAdd;
}
}
return T;
}
Preemptive Scheduling โ
int T = 0;
HashMap<Integer, Integer> H = new HashMap<>();
for (int k = 2; k < a.size(); k++) {
int key = a.get(k) % d;
H.put(key, H.getOrDefault(key, 0) + 1);
}
for (int j = 1; j < a.size(); j++) {
if (j >= 2) {
H.put(a.get(j) % d, H.get(a.get(j) % d) - 1);
}
for (int i = 0; i < j; i++) {
int matchingVal = (d - (a.get(i) + a.get(j)) % d) % d;
int toAdd = H.getOrDefault(matchingVal, 0);
T += toAdd;
}
}
return T;
}
Preemptive Scheduling โ
๐1
#include <iostream>
#include <vector>
#include <string>
using namespace std;
long long getTotalPalindromeTransformationCost(const string& s) {
int mask = 0;
int n = s.length();
vector<int> f(26, 0);
long long ans = 0;
for (int i = 0; i < n; i++) {
mask ^= 1 << (s[i] - 'a');
int cnt = 0;
for (int j = 0; j < 26; j++) {
if (mask & (1 << j)) {
cnt += i + 1 - f[j];
f[j] += 1;
} else {
cnt += f[j];
}
}
ans += (cnt - (i + 2) / 2) / 2;
}
return ans;
}
๐2๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Linkedin
Sign Up | LinkedIn
500 million+ members | Manage your professional identity. Build and engage with your professional network. Access knowledge, insights and opportunities.
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
โ ๏ธReferral Alert
Thereโs an opening for developer job in Thoughtworks for 2023/24 batch-11.10LPA.
Only for Female and Gender Diverse people.
I can refer suitable candidates for this position
piyushchhawachharia@gmail.com
Thereโs an opening for developer job in Thoughtworks for 2023/24 batch-11.10LPA.
Only for Female and Gender Diverse people.
I can refer suitable candidates for this position
piyushchhawachharia@gmail.com
๐คฎ8
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
https://www.linkedin.com/posts/gayathri-srinivasa-2523621b3_exciting-job-opportunity-scrum-master-activity-7254816468570132481-PShR?utm_source=share&utm_medium=member_desktop
๐ Exciting Job Opportunity: Scrum Master (Intern + FT) ๐
๐ง To Apply: https://lnkd.in/gdZFAnnW
๐ Location: HSR Layout Bangalore, India
๐ข Work Arrangement: 5 Days On-Site
Open for Freshers
๐ค Qualifications:
- Graduated with a degree in BE/BTech/BCA + MBA/MCA/PGDM
๐ง To Apply:
https://lnkd.in/gdZFAnnW
๐ Exciting Job Opportunity: Scrum Master (Intern + FT) ๐
๐ง To Apply: https://lnkd.in/gdZFAnnW
๐ Location: HSR Layout Bangalore, India
๐ข Work Arrangement: 5 Days On-Site
Open for Freshers
๐ค Qualifications:
- Graduated with a degree in BE/BTech/BCA + MBA/MCA/PGDM
๐ง To Apply:
https://lnkd.in/gdZFAnnW
Linkedin
Gayathri Srinivasa on LinkedIn: ๐ Exciting Job Opportunity: Scrum Master (Intern + FT) ๐
๐ง To Apply:โฆ | 21 comments
๐ง To Apply:โฆ | 21 comments
๐ Exciting Job Opportunity: Scrum Master (Intern + FT) ๐
๐ง To Apply: https://lnkd.in/gdZFAnnW
๐ Location: HSR Layout Bangalore, India
๐ข Work Arrangement:โฆ | 21 comments on LinkedIn
๐ง To Apply: https://lnkd.in/gdZFAnnW
๐ Location: HSR Layout Bangalore, India
๐ข Work Arrangement:โฆ | 21 comments on LinkedIn
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐คฎ2
OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ
โ ๏ธReferral Alert Thereโs an opening for developer job in Thoughtworks for 2023/24 batch-11.10LPA. Only for Female and Gender Diverse people. I can refer suitable candidates for this position piyushchhawachharia@gmail.com
All the female grads who fill up the form are referred:)
๐คฎ11โค1๐1
#include <bits/stdc++.h>
using namespace std;
long long binomialCoeff(int n, int k) {
long long res = 1;
if (k > n - k)
k = n - k;
for (int i = 0; i < k; ++i) {
res *= (n - i);
res /= (i + 1);
}
return res;
}
long long catalanNumber(int k) {
long long c = binomialCoeff(2 * k, k);
return c / (k + 1);
}
int main() {
int n;
cin >> n;
long long result = catalanNumber(n - 1);
cout << result << endl;
return 0;
}
Unlucky Hackerโ
Walmart
#include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;
int ss(int n, vector<int>& arr) {
unordered_map<int, int> frequency;
for (int num : arr) {
frequency[num]++;
}
int odd_count = 0;
for (auto& pair : frequency) {
if (pair.second % 2 != 0) {
odd_count++;
}
}
return odd_count / 2;
}
int main() {
int N;
cin >> N;
vector<int> arr(N);
for (int i = 0; i < N; i++) {
cin >> arr[i];
}
int result = ss(N, arr);
cout << result << endl;
return 0;
}
push popโ
Walmart
#include <iostream>
#include <vector>
#include <unordered_set>
using namespace std;
void computeSums(const vector<int>& a, vector<int>& b, int c, int d) {
if (c == a.size()) {
b.push_back(d);
return;
}
computeSums(a, b, c + 1, d + a[c]);
computeSums(a, b, c + 1, d);
}
int main() {
int e, f;
cin >> e;
cin >> f;
vector<int> g(e);
for (int h = 0; h < e; h++) {
cin >> g[h];
}
vector<int> i, j;
computeSums(vector<int>(g.begin(), g.begin() + e / 2), i, 0, 0);
computeSums(vector<int>(g.begin() + e / 2, g.end()), j, 0, 0);
unordered_set<int> k(i.begin(), i.end());
for (int l : j) {
if (k.count(f - l)) {
cout << 1 << endl;
return 0;
}
}
cout << 0 << endl;
return 0;
}
Calorie combination โ
Walmart
๐2
#include <iostream>
#include <bitset>
using namespace std;
bool isPow2Minus1(int n) {
return (n & (n + 1)) == 0;
}
int maxSplitAnd(int num) {
string b = bitset<32>(num).to_string();
int m = b.find('1');
b = b.substr(m);
int maxRes = -1;
for (int i = 1; i < b.length(); i++) {
int p1 = stoi(b.substr(0, i), nullptr, 2);
int p2 = stoi(b.substr(i), nullptr, 2);
int res = p1 & p2;
if (isPow2Minus1(res)) {
maxRes = max(maxRes, res);
}
}
return maxRes;
}
int main() {
int n;
cin >> n;
cout << maxSplitAnd(n) << endl;
return 0;
}
Break and Join โ
๐ฅ1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Innomotics is hiring Software Developer
For 2021, 2022, 2023 grads
Location: Bangalore
https://jobs.innomotics.com/job/Bangalore-Software-developer/1134410201/
For 2021, 2022, 2023 grads
Location: Bangalore
https://jobs.innomotics.com/job/Bangalore-Software-developer/1134410201/
Innomotics
Software developer
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Qylis Technologies is hiring Front-end Developer
For 2023, 2024 grads
Location: Hyderabad
https://www.linkedin.com/jobs/view/4058010474
For 2023, 2024 grads
Location: Hyderabad
https://www.linkedin.com/jobs/view/4058010474
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <bits/stdc++.h>
using namespace std;
bool comp(pair<int, int> &p1, pair<int, int> &p2) {
if (p1.first == p2.first) return p1.second > p2.second;
return p1.first > p2.first;
}
int main() {
int n;
cin >> n;
vector<pair<int, int>> a(n);
int e = 0, f = 0;
for (int i = 0; i < n; i++) {
int x, y;
cin >> x >> y;
a.push_back({x + y, x});
e += x;
}
sort(a.begin(), a.end(), comp);
int cnt = 0;
for (int i = 0; i < n && f <= e; i++) {
f += a[i].first ,e -= a[i].second;
cnt++;
}
cout << cnt;
return 0;
}
Chairman โ
Walmart
using namespace std;
bool comp(pair<int, int> &p1, pair<int, int> &p2) {
if (p1.first == p2.first) return p1.second > p2.second;
return p1.first > p2.first;
}
int main() {
int n;
cin >> n;
vector<pair<int, int>> a(n);
int e = 0, f = 0;
for (int i = 0; i < n; i++) {
int x, y;
cin >> x >> y;
a.push_back({x + y, x});
e += x;
}
sort(a.begin(), a.end(), comp);
int cnt = 0;
for (int i = 0; i < n && f <= e; i++) {
f += a[i].first ,e -= a[i].second;
cnt++;
}
cout << cnt;
return 0;
}
Chairman โ
Walmart