Geek Countโ
const int MOD = 1000000007;
int countGeekSubsequences(const string& s) {
int n = s.length();
vector<vector<int>> dp(5, vector<int>(n + 1, 0));
for (int i = 0; i < 5; ++i)
dp[i][0] = 0;
for (int i = 0; i <= n; ++i)
dp[0][i] = 1;
for (int i = 1; i <= 4; ++i) {
for (int j = 1; j <= n; ++j) {
dp[i][j] = dp[i][j - 1];
if (s[j - 1] == "geek"[i - 1])
dp[i][j] = (dp[i][j] + dp[i - 1][j - 1]) % MOD;
}
}
return dp[4][n];
}
๐1
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Geek Countโ
const int MOD = 1000000007; int countGeekSubsequences(const string& s) { int n = s.length(); vector<vector<int>> dp(5, vector<int>(n + 1, 0)); for (int i = 0; i < 5; ++i) dp[i][0] = 0; for (int i = 0; i <= n; ++i)โฆ
๐1
#include <vector>
#include <unordered_map>
#include <iostream>
using namespace std;
int getMinTransactions(int n, vector<vector<int>>& debt) {
unordered_map<int, int> balance
for (const auto& d : debt) {
balance[d[0]] -= d[2];
balance[d[1]] += d[2];
}
vector<int> transactions;
for (const auto& entry : balance) {
if (entry.second != 0) {
transactions.push_back(entry.second);
}
}
int count = 0;
int i = 0, j = transactions.size() - 1;
while (i < j) {
if (transactions[i] + transactions[j] == 0) {
count++;
i++;
j--;
} else if (transactions[i] + transactions[j] > 0) {
transactions[i] += transactions[j];
j--;
count++;
} else {
transactions[j] += transactions[i];
i++;
count++;
}
}
return count;
}
Transaction Simplification โ
#include <unordered_map>
#include <iostream>
using namespace std;
int getMinTransactions(int n, vector<vector<int>>& debt) {
unordered_map<int, int> balance
for (const auto& d : debt) {
balance[d[0]] -= d[2];
balance[d[1]] += d[2];
}
vector<int> transactions;
for (const auto& entry : balance) {
if (entry.second != 0) {
transactions.push_back(entry.second);
}
}
int count = 0;
int i = 0, j = transactions.size() - 1;
while (i < j) {
if (transactions[i] + transactions[j] == 0) {
count++;
i++;
j--;
} else if (transactions[i] + transactions[j] > 0) {
transactions[i] += transactions[j];
j--;
count++;
} else {
transactions[j] += transactions[i];
i++;
count++;
}
}
return count;
}
Transaction Simplification โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Urban Company is Hiring Business Development Interns
Eligibility: Tech & Non-Tech both
Graduation Year: 2024, 2025, 2026
Expected Stipend: 20k - 25k per month
Location: Mumbai
Apply Link:
https://www.foundit.in/zuno/job/business-development-associate-intern-6?utm_source=campus-ambassador&utm_medium=urbancompany&utm_campaign=ZW4204
Eligibility: Tech & Non-Tech both
Graduation Year: 2024, 2025, 2026
Expected Stipend: 20k - 25k per month
Location: Mumbai
Apply Link:
https://www.foundit.in/zuno/job/business-development-associate-intern-6?utm_source=campus-ambassador&utm_medium=urbancompany&utm_campaign=ZW4204
www.foundit.in
Business Development Associate Intern | Internships, Jobs - Zuno by Foundit
Urban Company is hiring for Business Development Associate Intern on Zuno by Foundit | Apply now
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐Monk Commerce is hiring for Frontend Engineer SDE I - Remote (0-2 years)
Apply here:
https://linkedin.com/jobs/view/3917231666/
Apply here:
https://linkedin.com/jobs/view/3917231666/
Linkedin
Monk Commerce hiring Frontend Engineer - SDE I in India | LinkedIn
Posted 8:21:55 PM. Weโre a fully remote team of 15 people - looking for a new member to join our engineering teamโฆ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)
Avalara Hiring Fresher For Associate Analyst
Location: Pune
Qualification: MBA
Work Experience: Fresher - 2 Years
Salary: 6 LPA
Apply Link: https://careers.avalara.com/jobs/12839?lang=en-us&iis=Job+Board&iisn=LinkedIn
Location: Pune
Qualification: MBA
Work Experience: Fresher - 2 Years
Salary: 6 LPA
Apply Link: https://careers.avalara.com/jobs/12839?lang=en-us&iis=Job+Board&iisn=LinkedIn
Associate Analyst in Pune, India | Avalara
Avalara is hiring a Associate Analyst in Pune, India. Review all of the job details and apply today!
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
int solve(int n, int k, int a) { int ans = (k + a - 1) % n; if (ans == 0) { ans = n; } return ans; } Card โ
Flipkart
def last_candy_recipient(N, K, A):
remaining_candies = K % N
last_recipient = (A + remaining_candies - 1) % N
if last_recipient == 0:
return N
else:
return last_recipient
Card โ
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define maxn 1000005
#define inf 1e9
string ff(ll a, ll b, ll c, ll d) {
ll kit = (b - a + 1) * (d - c + 1);
ll kat = (b - a + 1) * (d - c);
return (kat > kit / 2) ? "YES" : "NO";
}
int main() {
ll a, b, c, d;
cin >> a >> b;
cin >> c >> d;
cout << ff(a, b, c, d) << endl;
return 0;
}
Guess the full form โ
Flipkart
using namespace std;
#define ll long long
#define maxn 1000005
#define inf 1e9
string ff(ll a, ll b, ll c, ll d) {
ll kit = (b - a + 1) * (d - c + 1);
ll kat = (b - a + 1) * (d - c);
return (kat > kit / 2) ? "YES" : "NO";
}
int main() {
ll a, b, c, d;
cin >> a >> b;
cin >> c >> d;
cout << ff(a, b, c, d) << endl;
return 0;
}
Guess the full form โ
Flipkart
def probability_comparison(L1, R1, L2, R2):
alice_wins = 0
for i in range(L1, R1+1):
for j in range(L2, R2+1):
if i > j:
alice_wins += 1
total_outcomes = (R1 - L1 + 1) * (R2 - L2 + 1)
if alice_wins > total_outcomes / 2:
return "YES"
else:
return "NO"
L1, R1, L2, R2 = map(int, input().split())
print(probability_comparison(L1, R1, L2, R2))
Prediction โ
alice_wins = 0
for i in range(L1, R1+1):
for j in range(L2, R2+1):
if i > j:
alice_wins += 1
total_outcomes = (R1 - L1 + 1) * (R2 - L2 + 1)
if alice_wins > total_outcomes / 2:
return "YES"
else:
return "NO"
L1, R1, L2, R2 = map(int, input().split())
print(probability_comparison(L1, R1, L2, R2))
Prediction โ
def decode_secret_code(S, N):
if N == 1:
return S
rows = [''] * N
row = 0
down = True
for char in S:
rows[row] += char
if row == 0:
down = True
elif row == N - 1:
down = False
if down:
row += 1
else:
row -= 1
secret_code = ''.join(rows)
return secret_code
S = input()
N = int(input())
result = decode_secret_code(S, N)
print(result)
Flipkart โ
if N == 1:
return S
rows = [''] * N
row = 0
down = True
for char in S:
rows[row] += char
if row == 0:
down = True
elif row == N - 1:
down = False
if down:
row += 1
else:
row -= 1
secret_code = ''.join(rows)
return secret_code
S = input()
N = int(input())
result = decode_secret_code(S, N)
print(result)
Flipkart โ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
def decode_secret_code(S, N): if N == 1: return S rows = [''] * N row = 0 down = True for char in S: rows[row] += char if row == 0: down = True elif row == N - 1: downโฆ
#include <iostream>
#include <vector>
using namespace std;
string findPassword(string s, int n) {
if (n == 1)
return s;
vector<vector<char>> zigzag(n, vector<char>());
bool down = true;
int row = 0;
for (char c : s) {
zigzag[row].push_back(c);
if (down)
row++;
else
row--;
if (row == 0 || row == n - 1)
down = !down;
}
string password;
for (int i = 0; i < n; i++) {
for (char c : zigzag[i]) {
password += c;
}
}
return password;
}
int main() {
string s;
int n;
cin >> s >> n;
cout << findPassword(s, n) << endl;
return 0;
}
Flipkartโ
#include <vector>
using namespace std;
string findPassword(string s, int n) {
if (n == 1)
return s;
vector<vector<char>> zigzag(n, vector<char>());
bool down = true;
int row = 0;
for (char c : s) {
zigzag[row].push_back(c);
if (down)
row++;
else
row--;
if (row == 0 || row == n - 1)
down = !down;
}
string password;
for (int i = 0; i < n; i++) {
for (char c : zigzag[i]) {
password += c;
}
}
return password;
}
int main() {
string s;
int n;
cin >> s >> n;
cout << findPassword(s, n) << endl;
return 0;
}
Flipkartโ
๐1
#include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> arr(n);
for(int i = 0; i < n; i++) {
cin >> arr[i];
}
stack<int> s;
vector<int> nwe(n, -1);
for(int i = 0; i < n; i++) {
while(!s.empty() && arr[s.top()] > arr[i]) {
nwe[s.top()] = arr[i];
s.pop();
}
s.push(i);
}
for(int i = 0; i < n; i++) {
cout << nwe[i] << " ";
}
cout << endl;
return 0;
}
using namespace std;
int main() {
int n;
cin >> n;
vector<int> arr(n);
for(int i = 0; i < n; i++) {
cin >> arr[i];
}
stack<int> s;
vector<int> nwe(n, -1);
for(int i = 0; i < n; i++) {
while(!s.empty() && arr[s.top()] > arr[i]) {
nwe[s.top()] = arr[i];
s.pop();
}
s.push(i);
}
for(int i = 0; i < n; i++) {
cout << nwe[i] << " ";
}
cout << endl;
return 0;
}
Detecting perfect number โ
#include <iostream>
using namespace std;
int maxChocolateCakes(int A, int P) {
int totalPieces = A * 3 + P;
return totalPieces / 2;
}
int main() {
int A, P;
cin >> A >> P;
int maxCakes = maxChocolateCakes(A, P);
cout << maxCakes << endl;
return 0;
}
Chocoland โ
using namespace std;
int maxChocolateCakes(int A, int P) {
int totalPieces = A * 3 + P;
return totalPieces / 2;
}
int main() {
int A, P;
cin >> A >> P;
int maxCakes = maxChocolateCakes(A, P);
cout << maxCakes << endl;
return 0;
}
Chocoland โ