#include<bits/stdc++.h>
using namespace std;
void solve(string acc, int b, int c, int a, int n) {
if(acc.size() == n) {
cout << acc << endl;
return;
}
if(b > 0) solve(acc + 'B', b - 1, c, a, n);
if(c > 0) solve(acc + 'C', b, c - 1, a, n);
if(a > 0) solve(acc + 'A', b, c, a - 1, n);
}
int main() {
int n, b, c, a;
cin >> n >> b >> c >> a;
solve("", b, c, a, n);
return 0;
}
Walmart โ
using namespace std;
void solve(string acc, int b, int c, int a, int n) {
if(acc.size() == n) {
cout << acc << endl;
return;
}
if(b > 0) solve(acc + 'B', b - 1, c, a, n);
if(c > 0) solve(acc + 'C', b, c - 1, a, n);
if(a > 0) solve(acc + 'A', b, c, a - 1, n);
}
int main() {
int n, b, c, a;
cin >> n >> b >> c >> a;
solve("", b, c, a, n);
return 0;
}
Walmart โ
#include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for(int i = 0; i < n; i++) {
cin >> a[i];
}
vector<int> ng(n, -1), mr(n);
stack<int> s;
for(int i = n - 1; i >= 0; i--) {
while(!s.empty() && s.top() <= a[i]) {
s.pop();
}
if(!s.empty()) {
ng[i] = s.top();
}
s.push(a[i]);
mr[i] = i == n - 1 ? a[i] : max(a[i], mr[i + 1]);
}
int md = 0;
for(int i = 0; i < n; i++) {
if(ng[i] != -1) {
md = max(md, abs(ng[i] - mr[i]));
}
}
cout << md << endl;
return 0;
}
Walmart โ
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for(int i = 0; i < n; i++) {
cin >> a[i];
}
vector<int> ng(n, -1), mr(n);
stack<int> s;
for(int i = n - 1; i >= 0; i--) {
while(!s.empty() && s.top() <= a[i]) {
s.pop();
}
if(!s.empty()) {
ng[i] = s.top();
}
s.push(a[i]);
mr[i] = i == n - 1 ? a[i] : max(a[i], mr[i + 1]);
}
int md = 0;
for(int i = 0; i < n; i++) {
if(ng[i] != -1) {
md = max(md, abs(ng[i] - mr[i]));
}
}
cout << md << endl;
return 0;
}
Walmart โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Kirana club is looking for interns and full time roles, if you are interested you can apply by fill out this form
Apply: https://docs.google.com/forms/d/e/1FAIpQLSfzxtwQe2CTFfqbUt99DnbNiP1rQF_haRpC7Ppt9kftEck4Lg/viewform
Apply: https://docs.google.com/forms/d/e/1FAIpQLSfzxtwQe2CTFfqbUt99DnbNiP1rQF_haRpC7Ppt9kftEck4Lg/viewform
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: Redbus
Role: Associate Software Engineer
Batch eligible: 2023 and 2024 grads
Apply: https://www.redbus.in/careers/jobsdesc?jobid=a65a77cc210756#
Role: Associate Software Engineer
Batch eligible: 2023 and 2024 grads
Apply: https://www.redbus.in/careers/jobsdesc?jobid=a65a77cc210756#
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Allen Digital is hiring for Software Engineers in multiple domains.
Frontend
Backend
Full Stack
IoS and Android
Only Experienced Candidates ( Batch of 2022/2021/2020 and before) can send their resumes to TA@allen.in
Frontend
Backend
Full Stack
IoS and Android
Only Experienced Candidates ( Batch of 2022/2021/2020 and before) can send their resumes to TA@allen.in
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐RedBus is Hiring !!
Role: Associate Software Engineer
Experience: 0-1 years
Expected CTC: 7-12 LPA
๐Apply here: https://www.redbus.in/careers/jobsdesc?jobid=a65a77cc210756
Role: Associate Software Engineer
Experience: 0-1 years
Expected CTC: 7-12 LPA
๐Apply here: https://www.redbus.in/careers/jobsdesc?jobid=a65a77cc210756
Do you enjoy reading this channel?
Perhaps you have thought about placing ads on it?
To do this, follow three simple steps:
1) Sign up: https://telega.io/c/cs_algo
2) Top up the balance in a convenient way
3) Create an advertising post
If the topic of your post fits our channel, we will publish it with pleasure.
Perhaps you have thought about placing ads on it?
To do this, follow three simple steps:
1) Sign up: https://telega.io/c/cs_algo
2) Top up the balance in a convenient way
3) Create an advertising post
If the topic of your post fits our channel, we will publish it with pleasure.
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Deloitte India is hiring PAN India for multiple roles (0-10yrs exp)
Positions open for:
Stat Audit
Internal audit
IDT
DT
FDD
Valuation/IB
Can fill multiple positions and location as well
Interested candidates can fill the google form: https://docs.google.com/forms/d/e/1FAIpQLSdh7-otexdfFPiHaytaZdiNkKVOjzxBfoUqsg_6p8JMxPK9DQ/viewform
Apply using the link you will receive on email after the referral
Positions open for:
Stat Audit
Internal audit
IDT
DT
FDD
Valuation/IB
Can fill multiple positions and location as well
Interested candidates can fill the google form: https://docs.google.com/forms/d/e/1FAIpQLSdh7-otexdfFPiHaytaZdiNkKVOjzxBfoUqsg_6p8JMxPK9DQ/viewform
Apply using the link you will receive on email after the referral
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
If interested send ur resume hena.haris@carelon.com
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: Zeta
Role: SRE Intern
Batch eligible: 2024 grads
Apply: https://jobs.lever.co/zeta/0390b206-716c-4837-a1b7-7c3e44c21ad2
Role: SRE Intern
Batch eligible: 2024 grads
Apply: https://jobs.lever.co/zeta/0390b206-716c-4837-a1b7-7c3e44c21ad2
Please open Telegram to view this post
VIEW IN TELEGRAM
def getSubsequenceCount(s1, s2):
def count_subsequences(s1, s2, index1, index2):
if index1 == 3:
return 1
if index2 == len(s2):
return 0
count = count_subsequences(s1, s2, index1, index2 + 1)
if s1[index1] == s2[index2]:
count += count_subsequences(s1, s2, index1 + 1, index2 + 1)
return count
return count_subsequences(s1, s2, 0, 0)
Meesho โ
def count_subsequences(s1, s2, index1, index2):
if index1 == 3:
return 1
if index2 == len(s2):
return 0
count = count_subsequences(s1, s2, index1, index2 + 1)
if s1[index1] == s2[index2]:
count += count_subsequences(s1, s2, index1 + 1, index2 + 1)
return count
return count_subsequences(s1, s2, 0, 0)
Meesho โ
def maximum_learning(iv, articles, p):
size = len(articles)
art = [x * 2 for x in articles]
ivs = iv
return knap_sack_top_down(ivs, art, p, size)
def knap_sack_top_down(val, wt, W, n):
mat = [[0] * (W + 1) for _ in range(n + 1)]
for i in range(1, n + 1):
for j in range(1, W + 1):
if i == 0 or j == 0:
mat[i][j] = 0
elif wt[i - 1] <= j:
mat[i][j] = max(val[i - 1] + mat[i - 1][j - wt[i - 1]], mat[i - 1][j])
else:
mat[i][j] = mat[i - 1][j]
return mat[n][W]
Meesho โ
size = len(articles)
art = [x * 2 for x in articles]
ivs = iv
return knap_sack_top_down(ivs, art, p, size)
def knap_sack_top_down(val, wt, W, n):
mat = [[0] * (W + 1) for _ in range(n + 1)]
for i in range(1, n + 1):
for j in range(1, W + 1):
if i == 0 or j == 0:
mat[i][j] = 0
elif wt[i - 1] <= j:
mat[i][j] = max(val[i - 1] + mat[i - 1][j - wt[i - 1]], mat[i - 1][j])
else:
mat[i][j] = mat[i - 1][j]
return mat[n][W]
Meesho โ
import heapq
def getSeatsAllocation(arr):
n = len(arr)
ppl = [[] for i in range(2 * n + 4)]
for i, x in enumerate(arr):
ppl[x].append(i)
h = []
ans = [-1] * n
for pos in range(1, 2 * n + 1):
for i in ppl[pos]:
heapq.heappush(h, (-pos, i))
if len(h) > 0:
ans[heapq.heappop(h)[1]] = pos
return ans
Meesho โ
def getSeatsAllocation(arr):
n = len(arr)
ppl = [[] for i in range(2 * n + 4)]
for i, x in enumerate(arr):
ppl[x].append(i)
h = []
ans = [-1] * n
for pos in range(1, 2 * n + 1):
for i in ppl[pos]:
heapq.heappush(h, (-pos, i))
if len(h) > 0:
ans[heapq.heappop(h)[1]] = pos
return ans
Meesho โ
def max_tie_moments(n, moments):
max_tie_count = 0
current_difference = 0
for moment in moments:
bob_goals, noddy_goals = moment
difference = bob_goals - noddy_goals
if difference == current_difference:
max_tie_count += 1
elif difference > current_difference:
current_difference = difference
max_tie_count = 0
return max_tie_count
max_tie_count = 0
current_difference = 0
for moment in moments:
bob_goals, noddy_goals = moment
difference = bob_goals - noddy_goals
if difference == current_difference:
max_tie_count += 1
elif difference > current_difference:
current_difference = difference
max_tie_count = 0
return max_tie_count