#include <bits/stdc++.h>
using namespace std;
bool dfs(char current, char start, string &path, map<char, set<char>> &adj, set<char> &used, int target) {
if (path.size() == target) {
if (adj[current].count(start)) {
path.push_back(start);
return true;
}
return false;
}
for (char next : adj[current]) {
if (!used.count(next)) {
used.insert(next);
path.push_back(next);
if (dfs(next, start, path, adj, used, target)) return true;
path.pop_back();
used.erase(next);
}
}
return false;
}
string gemWord(int input1, string input2) {
set<char> unique_chars(input2.begin(), input2.end());
if (unique_chars.size() < input1) return "No";
map<char, set<char>> adj;
int n = input2.size();
for (int i = 0; i < n - 1; ++i) {
adj[input2[i]].insert(input2[i + 1]);
adj[input2[i + 1]].insert(input2[i]);
}
string result;
bool found = false;
for (char ch : unique_chars) {
string path = "";
set<char> used = {ch};
path.push_back(ch);
if (dfs(ch, ch, path, adj, used, input1)) {
if (!found || path < result) {
result = path.substr(0, path.size() - 1);
found = true;
}
}
}
return found ? result : "No";
}
gem word 9/10โ
import math
def destroyMonster(n, a):
dp = [[0] * n for _ in range(n)]
for length in range(2, n + 1, 2):
for i in range(n - length + 1):
j = i + length - 1
if length == 2:
dp[i][j] = math.gcd(a[i], a[j])
else:
dp[i][j] = float('inf')
for k in range(i + 1, j, 2):
cost = math.gcd(a[i], a[k]) + dp[i+1][k-1] + dp[k+1][j]
dp[i][j] = min(dp[i][j], cost)
return dp[0][n-1]
Destroy all monsters โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
DoorDash is Hiring
Role : Software Engineering Intern
Batch : 2024,2025
Referral Link : https://grnh.se/abd3c3701us
Role : Software Engineering Intern
Batch : 2024,2025
Referral Link : https://grnh.se/abd3c3701us
boards.greenhouse.io
DoorDash USA
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Adobe is hiring for SDET role
Batch : 2021, 2022 passouts
Location : Noida
Apply Here :
https://careers.adobe.com/us/en/job/ADOBUSR149707EXTERNALENUS/Software-Development-Engineer-in-Test-Java?utm_medium=phenom-feeds&source=LinkedIn&utm_source=linkedin
Batch : 2021, 2022 passouts
Location : Noida
Apply Here :
https://careers.adobe.com/us/en/job/ADOBUSR149707EXTERNALENUS/Software-Development-Engineer-in-Test-Java?utm_medium=phenom-feeds&source=LinkedIn&utm_source=linkedin
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐ Company: Snoodify
Looking for interns who are good with Search and Recommendation algorithms ML
โ๏ธMail your profiles to dheekshith@snoodify.com
Hiring immediately. Preferably college students.
Looking for interns who are good with Search and Recommendation algorithms ML
โ๏ธMail your profiles to dheekshith@snoodify.com
Hiring immediately. Preferably college students.
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Zomato hiring For Freshers and Experienced
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: Branch International
Role: Software Engineer Intern
Batch eligible: 2025 grads only
Apply: https://branchinternational.applytojob.com/apply/eahXMYz8pY/Software-Engineer-Intern
Role: Software Engineer Intern
Batch eligible: 2025 grads only
Apply: https://branchinternational.applytojob.com/apply/eahXMYz8pY/Software-Engineer-Intern
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
RetainIQ is hiring Front-end Engineer
For 2022, 2023, 2024 grads
Location: Bangalore
https://www.linkedin.com/jobs/view/4026030299
For 2022, 2023, 2024 grads
Location: Bangalore
https://www.linkedin.com/jobs/view/4026030299
Linkedin
RetainIQ hiring Front End Engineer in Bengaluru, Karnataka, India | LinkedIn
Posted 3:50:31 PM. About RetainIQRetainIQ Job Description - Frontend EngineerRetainIQ enables e-commerce stores & D2Cโฆ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)
Swiss Re is hiring for Software Engineer
Experience: 0 - 2 year's
Expected Salary: 10-15 LPA
Apply here: https://careers.swissre.com/job/Bangalore-Software-Engineer-KA/1121954201/
Experience: 0 - 2 year's
Expected Salary: 10-15 LPA
Apply here: https://careers.swissre.com/job/Bangalore-Software-Engineer-KA/1121954201/
ll solver(vll &grid,int n,int m, int row,int col){
ll cnt=1;
ll x1=1;
while(true){
if(row-x1>=0 and col-x1>=0 and row+x1<n and col+x1<m and grid[row-x1][col-x1]==1 and grid[row-x1][col+x1]==1 and grid[row+x1][col+x1] and grid[row+x1][col-x1]==1){
x1++;
cnt++;
}
else{
break;
}
}
return cnt;
}
int help(vll grid,int n,int m){
ll ans=0;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(grid[i][j]==1)
ans+=solver(grid,n,m,i,j);
}
}
return ans;
}
Coinbase โ
ll cnt=1;
ll x1=1;
while(true){
if(row-x1>=0 and col-x1>=0 and row+x1<n and col+x1<m and grid[row-x1][col-x1]==1 and grid[row-x1][col+x1]==1 and grid[row+x1][col+x1] and grid[row+x1][col-x1]==1){
x1++;
cnt++;
}
else{
break;
}
}
return cnt;
}
int help(vll grid,int n,int m){
ll ans=0;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(grid[i][j]==1)
ans+=solver(grid,n,m,i,j);
}
}
return ans;
}
Coinbase โ
def solution(state, operations):
n = len(state)
pq = []
for i in range(n):
if state[i] == 0:
heapq.heappush(pq, i)
for operation in operations:
if operation == "L":
if pq:
idx = heapq.heappop(pq)
state[idx] = 1
elif operation[0] == 'C':
index = int(operation[1:])
if state[index] == 1:
state[index] = 0
heapq.heappush(pq, index)
result = ''.join(map(str, state))
return result
Coinbase โ
n = len(state)
pq = []
for i in range(n):
if state[i] == 0:
heapq.heappush(pq, i)
for operation in operations:
if operation == "L":
if pq:
idx = heapq.heappop(pq)
state[idx] = 1
elif operation[0] == 'C':
index = int(operation[1:])
if state[index] == 1:
state[index] = 0
heapq.heappush(pq, index)
result = ''.join(map(str, state))
return result
Coinbase โ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
pair<string, int> pL(const string& l) {
size_t sp = l.find(' ');
string n = l.substr(0, sp);
int t = stoi(l.substr(sp + 1));
return {n, t};
}
vector<string> sol(vector<vector<string>>& laps) {
unordered_map<string, int> bt;
vector<string> d;
vector<string> eo;
for (const string& l : laps[0]) {
auto [n, t] = pL(l);
bt[n] = t;
d.push_back(n);
}
for (const auto& lap : laps) {
for (const string& dl : lap) {
auto [n, t] = pL(dl);
bt[n] = min(bt[n], t);
}
int sT = 0;
for (const string& n : d) {
sT = max(sT, bt[n]);
}
vector<string> eD;
for (auto it = d.begin(); it != d.end();) {
if (bt[*it] == sT) {
eD.push_back(*it);
it = d.erase(it);
} else {
++it;
}
}
sort(eD.begin(), eD.end());
eo.insert(eo.end(), eD.begin(), eD.end());
}
return eo;
}
Coinbase โ
size_t sp = l.find(' ');
string n = l.substr(0, sp);
int t = stoi(l.substr(sp + 1));
return {n, t};
}
vector<string> sol(vector<vector<string>>& laps) {
unordered_map<string, int> bt;
vector<string> d;
vector<string> eo;
for (const string& l : laps[0]) {
auto [n, t] = pL(l);
bt[n] = t;
d.push_back(n);
}
for (const auto& lap : laps) {
for (const string& dl : lap) {
auto [n, t] = pL(dl);
bt[n] = min(bt[n], t);
}
int sT = 0;
for (const string& n : d) {
sT = max(sT, bt[n]);
}
vector<string> eD;
for (auto it = d.begin(); it != d.end();) {
if (bt[*it] == sT) {
eD.push_back(*it);
it = d.erase(it);
} else {
++it;
}
}
sort(eD.begin(), eD.end());
eo.insert(eo.end(), eD.begin(), eD.end());
}
return eo;
}
Coinbase โ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
int solution(vector<int>& readings, int k) {
unordered_set<int> powers;
if (k == 1) {
for (int reading : readings) {
if (reading == 1) {
powers.insert(1);
}
}
} else {
long long power = 1;
while (power <= *max_element(readings.begin(), readings.end())) {
powers.insert(power);
power *= k;
}
}
int count = 0;
for (int reading : readings) {
if (powers.count(reading)) {
count++;
}
}
return count;
}
Coinbase โ
string solution(vector<int>& numbers) {
int even_sum = 0, odd_sum = 0;
for (int i = 0; i < numbers.size(); ++i) {
if (i % 2 == 0) {
even_sum += numbers[i];
} else {
odd_sum += numbers[i];
}
}
if (even_sum > odd_sum) {
return "even";
} else if (odd_sum > even_sum) {
return "odd";
} else {
return "equal";
}
}
Coinbase โ