#include <iostream>
#include <vector>
#include <unordered_set>
Vector<int> getGoodElements(vector<int>a){
unordered_set<int> set;
vector<int>ans;
for (int it : a) {
unordered_set<int> tmp(set);
for (int itt : set) {
if (itt < it) {
tmp.insert(it | itt);
}
}
set = tmp;
set.insert(it);
}
ans.push_back(0);
for(int i:set) ans.push_back(i);
return ans;
return 0;
}
Citadel โ
#include <vector>
#include <unordered_set>
Vector<int> getGoodElements(vector<int>a){
unordered_set<int> set;
vector<int>ans;
for (int it : a) {
unordered_set<int> tmp(set);
for (int itt : set) {
if (itt < it) {
tmp.insert(it | itt);
}
}
set = tmp;
set.insert(it);
}
ans.push_back(0);
for(int i:set) ans.push_back(i);
return ans;
return 0;
}
Citadel โ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <iostream>
#include <queue>
using namespace std;
class T {
public:
int x;
T* l;
T* r;
T(int x_, T* l_ = nullptr, T* r_ = nullptr) : x(x_), l(l_), r(r_) {}
T() : x(0), l(nullptr), r(nullptr) {}
};
T* extendT(T* node) {
if (!node) return node;
if (!node->l && !node->r) {
node->l = new T(node->x,nullptr,nullptr);
node->r = new T(node->x,nullptr,nullptr);
} else {
extendT(node->l);
extendT(node->r);
}
return node;
}
void printLevelOrder(T* root) {
if (!root) return;
queue<T*> q;
q.push(root);
while (!q.empty()) {
T* node = q.front();
q.pop();
cout << node->x << " ";
if (node->l) q.push(node->l);
if (node->r) q.push(node->r);
}
cout << endl;
}
int main() {
// Creating the specified binary T
T* root = new T(1);
root->l = new T(2);
root->r = new T(3);
root->l->l = new T(4);
root->l->r = new T(5);
root->r->l = new T(6);
cout << "Original T (Level-order traversal): ";
printLevelOrder(root);
root = extendT(root);
cout << "Extended T (Level-order traversal): ";
printLevelOrder(root);
return 0;
}
Intuit โ
Spreading fire
Spreading fire
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐จLatest Job Opening Update๐จ
Company โ Lumosys
Role โ Data Analyst
Exp. โ Fresher
Apply Here โ https://www.linkedin.com/jobs/view/3970590490
Company โ Cushman & Wakefield
Role โ Data Analyst
Exp. โ Fresher
Apply Here โ https://careers.cushmanwakefield.com/global/en/job/CUWAGLOBALR240308ENAPACEXTERNAL/Data-Analyst-Generalist?utm_source=linkedin&utm_medium=phenom-feeds
Company โ Maxgen Technologies Private Limited
Role โ DATA ANALYST INTERNSHIP
Exp. โ Fresher
Apply Here โ https://www.foundit.in/job/data-analyst-internship-at-pune-maxgen-technologies-private-limited-pune-aurangabad-31080862?searchId=024c17c0-43d0-4685-aa32-f7eff911576c
Company โ Soul Ai
Role โ Data Scientist
Exp. โ Fresher
Apply Here โ https://www.naukri.com/job-listings-data-scientist-soul-ai-hyderabad-0-to-0-years-080724010188?src=sortby&sid=17205139582078710_1&xp=6&px=1
Company โ Soul Ai
Role โ Data Engineer
Exp. โ Fresher
Apply Here โ https://www.naukri.com/job-listings-data-engineer-soul-ai-hyderabad-0-to-0-years-080724010135?src=sortby&sid=17205139582078710_1&xp=7&px=1
Company โ PartnerFirms
Role โ Data Engineer
Exp. โ Fresher
Apply Here โ https://www.linkedin.com/jobs/view/3967437296
Company โ Citi
Role โ Business Analytics Analyst
Exp. โ 0-2 yrs
Apply Here โ https://www.simplyhired.co.in/job/P_uzl7zlJZgSJBvCxnABn-Z6LhIh6x_tf2dyo9YFRarLi1y0nTBg
Company โ Resolute AI Software Private Limited
Role โ AI Engineer Intern
Exp. โ Fresher
Apply Here โ https://internshala.com/internship/details/work-from-home-ai-engineer-internship-at-resolute-ai-software-private-limited1720498515?utm_source=cp_link&referral=web_share
Company โ Lumosys
Role โ Data Analyst
Exp. โ Fresher
Apply Here โ https://www.linkedin.com/jobs/view/3970590490
Company โ Cushman & Wakefield
Role โ Data Analyst
Exp. โ Fresher
Apply Here โ https://careers.cushmanwakefield.com/global/en/job/CUWAGLOBALR240308ENAPACEXTERNAL/Data-Analyst-Generalist?utm_source=linkedin&utm_medium=phenom-feeds
Company โ Maxgen Technologies Private Limited
Role โ DATA ANALYST INTERNSHIP
Exp. โ Fresher
Apply Here โ https://www.foundit.in/job/data-analyst-internship-at-pune-maxgen-technologies-private-limited-pune-aurangabad-31080862?searchId=024c17c0-43d0-4685-aa32-f7eff911576c
Company โ Soul Ai
Role โ Data Scientist
Exp. โ Fresher
Apply Here โ https://www.naukri.com/job-listings-data-scientist-soul-ai-hyderabad-0-to-0-years-080724010188?src=sortby&sid=17205139582078710_1&xp=6&px=1
Company โ Soul Ai
Role โ Data Engineer
Exp. โ Fresher
Apply Here โ https://www.naukri.com/job-listings-data-engineer-soul-ai-hyderabad-0-to-0-years-080724010135?src=sortby&sid=17205139582078710_1&xp=7&px=1
Company โ PartnerFirms
Role โ Data Engineer
Exp. โ Fresher
Apply Here โ https://www.linkedin.com/jobs/view/3967437296
Company โ Citi
Role โ Business Analytics Analyst
Exp. โ 0-2 yrs
Apply Here โ https://www.simplyhired.co.in/job/P_uzl7zlJZgSJBvCxnABn-Z6LhIh6x_tf2dyo9YFRarLi1y0nTBg
Company โ Resolute AI Software Private Limited
Role โ AI Engineer Intern
Exp. โ Fresher
Apply Here โ https://internshala.com/internship/details/work-from-home-ai-engineer-internship-at-resolute-ai-software-private-limited1720498515?utm_source=cp_link&referral=web_share
Linkedin
Lumosys hiring Data Analyst in India | LinkedIn
Posted 6:10:02 AM. Company Description Welcome to Lumosys - Where Innovation Meets Excellence! Lumosys is a technologyโฆ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)
LSEG is hiring Associate Software Engineer
For 2023, 2022 grads
Apply - https://refinitiv.wd3.myworkdayjobs.com/Careers/job/IND-BLR-Divyasree-Technopolis/Associate-Software-Engineer-Java-1-to-2-yrs-_R0088243
For 2023, 2022 grads
Apply - https://refinitiv.wd3.myworkdayjobs.com/Careers/job/IND-BLR-Divyasree-Technopolis/Associate-Software-Engineer-Java-1-to-2-yrs-_R0088243
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Linkedin
Raghav Apoorv on LinkedIn: Uber Careers | 62 comments
Exciting News! Uber is Hiring! ๐
We're actively hiring across all levels, from New Grads to L3, L4, and L5a positions. If you're looking for an opportunity toโฆ | 62 comments on LinkedIn
We're actively hiring across all levels, from New Grads to L3, L4, and L5a positions. If you're looking for an opportunity toโฆ | 62 comments on LinkedIn
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Interactive Brokers is hiring for Junior Software Engineer
Expected Salary: 9-12 LPA
Apply here: https://boards.greenhouse.io/ibkr/jobs/7524334002?gh_src=19375f022
Expected Salary: 9-12 LPA
Apply here: https://boards.greenhouse.io/ibkr/jobs/7524334002?gh_src=19375f022
job-boards.greenhouse.io
Interactive Brokers
<p><span data-preserver-spaces="true">Interactive Brokers Group, Inc. (NASDAQ: "IBKR"); is a direct access electronic broker catering to the needs of professional and frequent traders, institutional investors, financial advisers, and introducing brokers.โฆ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐ANZ is hiring for Software Engineer
Experience: 0 - 3 years
Expected Salary: 9-20 LPA
Apply here:
https://careers.anz.com/job/Bangalore-Software-Engineer/1053439066/?feedId=349110&src=JB-10029
Experience: 0 - 3 years
Expected Salary: 9-20 LPA
Apply here:
https://careers.anz.com/job/Bangalore-Software-Engineer/1053439066/?feedId=349110&src=JB-10029
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Graduate Roles at Capua, London
Visa Sponsorship Available
Salary: 30,000-40000 Euros
Batch: 2021-2026
https://tally.so/r/nrPk5l
Tech as well as Non-Tech Roles available
Visa Sponsorship Available
Salary: 30,000-40000 Euros
Batch: 2021-2026
https://tally.so/r/nrPk5l
Tech as well as Non-Tech Roles available
Tally Forms
Capua Application Form
Made with Tally, the simplest way to create forms.
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Selector is hiring for the role of Data Engineer
Experience: 0-1 years
Apply here:
https://linkedin.com/jobs/view/3967440227/?alternateChannel=search
Experience: 0-1 years
Apply here:
https://linkedin.com/jobs/view/3967440227/?alternateChannel=search
Linkedin
Selector hiring Data Engineer in Bengaluru, Karnataka, India | LinkedIn
Posted 7:30:12 AM. About UsSelector is building an operational intelligence platform for digital infrastructure. Byโฆ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)
Medpace is hiring for Entry Level Software Engineer
Expected Salary: 5-9 LPA
Apply here: https://careers.medpace.com/jobs/9986?lang=en-us&iis=Job+Board&iisn=LinkedIn
Expected Salary: 5-9 LPA
Apply here: https://careers.medpace.com/jobs/9986?lang=en-us&iis=Job+Board&iisn=LinkedIn
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
MSCI โ
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
MSCI โ
๐1
#include <iostream>
#include <vector>
using namespace std;
const int MOD = 10000000;
int solve(int N, const string& a) {
vector<vector<int>> dp(N, vector<int>(3, 0));
if (a[0] != 'R') dp[0][0] = 1;
if (a[0] != 'P') dp[0][1] = 1;
if (a[0] != 'S') dp[0][2] = 1;
for (int i = 1; i < N; ++i) {
if (a[i] != 'R') {
dp[i][0] = (dp[i-1][1] + dp[i-1][2]) % MOD;
}
if (a[i] != 'P') {
dp[i][1] = (dp[i-1][0] + dp[i-1][2]) % MOD;
}
if (a[i] != 'S') {
dp[i][2] = (dp[i-1][0] + dp[i-1][1]) % MOD;
}
}
int ans = (dp[N-1][0] + dp[N-1][1] + dp[N-1][2]) % MOD;
return ans;
}.
RocK paper scissors โ
#include <vector>
using namespace std;
const int MOD = 10000000;
int solve(int N, const string& a) {
vector<vector<int>> dp(N, vector<int>(3, 0));
if (a[0] != 'R') dp[0][0] = 1;
if (a[0] != 'P') dp[0][1] = 1;
if (a[0] != 'S') dp[0][2] = 1;
for (int i = 1; i < N; ++i) {
if (a[i] != 'R') {
dp[i][0] = (dp[i-1][1] + dp[i-1][2]) % MOD;
}
if (a[i] != 'P') {
dp[i][1] = (dp[i-1][0] + dp[i-1][2]) % MOD;
}
if (a[i] != 'S') {
dp[i][2] = (dp[i-1][0] + dp[i-1][1]) % MOD;
}
}
int ans = (dp[N-1][0] + dp[N-1][1] + dp[N-1][2]) % MOD;
return ans;
}.
RocK paper scissors โ
โค1
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
const int MOD = 1e9 + 7;
const int MAXN = 101;
vector<int> primes;
vector<vector<int>> adj;
vector<vector<long long>> dp;
bool is_prime[MAXN];
void sieve() {
fill(is_prime, is_prime + MAXN, true);
is_prime[0] = is_prime[1] = false;
for (int i = 2; i < MAXN; ++i) {
if (is_prime[i]) {
primes.push_back(i);
for (int j = 2 * i; j < MAXN; j += i) {
is_prime[j] = false;
}
}
}
}
void preprocess(int N) {
sieve();
adj.clear();
adj.resize(N);
dp.clear();
dp.assign(N, vector<long long>(primes.size(), 1));
}
void dfs(int node, int par = -1) {
for (int ne : adj[node]) {
if (ne == par) continue;
dfs(ne, node);
for (int i = 0; i < (int)primes.size(); i++) {
long long t = 0;
for (int j = 0; j < (int)primes.size(); j++) {
if (is_prime[primes[i] + primes[j]]) continue;
t += dp[ne][j];
t %= MOD;
}
dp[node][i] *= t;
dp[node][i] %= MOD;
}
}
}
int solve(int N, vector<vector<int>> edges) {
preprocess(N);
if (N == 1) return primes.size();
for (vector<int> edge : edges) {
adj[edge[0]].push_back(edge[1]);
adj[edge[1]].push_back(edge[0]);
}
dfs(0);
long long ans = 0;
for (int i = 0; i < (int)primes.size(); i++) {
ans += dp[0][i];
ans %= MOD;
}
return ans;
}
int main() {
int N;
cin >> N;
vector<vector<int>> edges(N-1, vector<int>(2));
for (int i = 0; i < N-1; i++) {
cin >> edges[i][0] >> edges[i][1];
edges[i][0]--;
edges[i][1]--;
}
cout << solve(N, edges) << endl;
return 0;
}
prime tree code โ
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
const int MOD = 1e9 + 7;
const int MAXN = 101;
vector<int> primes;
vector<vector<int>> adj;
vector<vector<long long>> dp;
bool is_prime[MAXN];
void sieve() {
fill(is_prime, is_prime + MAXN, true);
is_prime[0] = is_prime[1] = false;
for (int i = 2; i < MAXN; ++i) {
if (is_prime[i]) {
primes.push_back(i);
for (int j = 2 * i; j < MAXN; j += i) {
is_prime[j] = false;
}
}
}
}
void preprocess(int N) {
sieve();
adj.clear();
adj.resize(N);
dp.clear();
dp.assign(N, vector<long long>(primes.size(), 1));
}
void dfs(int node, int par = -1) {
for (int ne : adj[node]) {
if (ne == par) continue;
dfs(ne, node);
for (int i = 0; i < (int)primes.size(); i++) {
long long t = 0;
for (int j = 0; j < (int)primes.size(); j++) {
if (is_prime[primes[i] + primes[j]]) continue;
t += dp[ne][j];
t %= MOD;
}
dp[node][i] *= t;
dp[node][i] %= MOD;
}
}
}
int solve(int N, vector<vector<int>> edges) {
preprocess(N);
if (N == 1) return primes.size();
for (vector<int> edge : edges) {
adj[edge[0]].push_back(edge[1]);
adj[edge[1]].push_back(edge[0]);
}
dfs(0);
long long ans = 0;
for (int i = 0; i < (int)primes.size(); i++) {
ans += dp[0][i];
ans %= MOD;
}
return ans;
}
int main() {
int N;
cin >> N;
vector<vector<int>> edges(N-1, vector<int>(2));
for (int i = 0; i < N-1; i++) {
cin >> edges[i][0] >> edges[i][1];
edges[i][0]--;
edges[i][1]--;
}
cout << solve(N, edges) << endl;
return 0;
}
prime tree code โ
def getMinimumCost(arr):
n = len(arr)
ans = 0
max_diff = 0
for i in range(n - 1):
a, b = arr[i], arr[i + 1]
max_diff = max(max_diff,abs(a-b))
ans += ((a-b)** 2)
if max_diff % 2 == 0:
ans = ans -max_diff**2/2
else:
ans = ans-max_diff 2 + ((max_diff-1) / 2) 2 + ((max_diff+1) / 2) ** 2
return int(ans)
MINIMIZE ARRAY COST โ
n = len(arr)
ans = 0
max_diff = 0
for i in range(n - 1):
a, b = arr[i], arr[i + 1]
max_diff = max(max_diff,abs(a-b))
ans += ((a-b)** 2)
if max_diff % 2 == 0:
ans = ans -max_diff**2/2
else:
ans = ans-max_diff 2 + ((max_diff-1) / 2) 2 + ((max_diff+1) / 2) ** 2
return int(ans)
MINIMIZE ARRAY COST โ
class Solution {
public:
string oddString(vector<string>& words) {
map<string,int> mp;int k = 3;
for(int j = 0;j<words.size();j++){
string temp;
for(int i = 0;i<words[j].size()-1;i++) temp.push_back(words[j][i+1]-words[j][i]);
mp[temp]+= k++;
if(mp.size()==2 and j>2)return words[min(begin(mp)->second,next(begin(mp))->second)-3];
}
return words[min(begin(mp)->second,next(begin(mp))->second)-3];
}
};
// ODD ONE OUT
โ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
long long solve(vector<int>& A) {
int N = A.size();
vector<vector<int>> dp(N + 1, vector<int>(N + 1, 0));
for (int L = 1; L <= N; ++L) {
stack<int> stack;
int trees = 0;
for (int R = L; R <= N; ++R) {
while (!stack.empty() && A[stack.top() - 1] < A[R - 1]) {
stack.pop();
}
if (stack.empty()) {
trees++;
}
stack.push(R);
int max_trees = trees;
if (R > L) {
if (stack.size() > 1) {
max_trees = max(max_trees, trees - 1);
} else {
max_trees = max(max_trees, trees);
}
if (R - L > trees) {
max_trees = max(max_trees, trees + 1);
}
}
dp[L][R] = max_trees;
}
}
long long result = 0;
for (int i = 1; i <= N; ++i) {
for (int j = i; j <= N; ++j) {
result = (result + dp[i][j]) % MOD;
}
}
return result;
}
int main() {
int n; cin>>n;
vector<int> A;
for(int i = 0; i < n; ++i) cin>>A[i];
cout << solve(A) << endl;
return 0;
}
//So many trees
using namespace std;
const int MOD = 1e9 + 7;
long long solve(vector<int>& A) {
int N = A.size();
vector<vector<int>> dp(N + 1, vector<int>(N + 1, 0));
for (int L = 1; L <= N; ++L) {
stack<int> stack;
int trees = 0;
for (int R = L; R <= N; ++R) {
while (!stack.empty() && A[stack.top() - 1] < A[R - 1]) {
stack.pop();
}
if (stack.empty()) {
trees++;
}
stack.push(R);
int max_trees = trees;
if (R > L) {
if (stack.size() > 1) {
max_trees = max(max_trees, trees - 1);
} else {
max_trees = max(max_trees, trees);
}
if (R - L > trees) {
max_trees = max(max_trees, trees + 1);
}
}
dp[L][R] = max_trees;
}
}
long long result = 0;
for (int i = 1; i <= N; ++i) {
for (int j = i; j <= N; ++j) {
result = (result + dp[i][j]) % MOD;
}
}
return result;
}
int main() {
int n; cin>>n;
vector<int> A;
for(int i = 0; i < n; ++i) cin>>A[i];
cout << solve(A) << endl;
return 0;
}
//So many trees