def getLongestMatch(regex, x):
parts = regex.split('*')
left = x.find(parts[0])
right = x.rfind(parts[1])
xy = right + len(parts[1]) - left
if left == -1 or right == -1 or left >= right:
return -1
else:
if xy == 854770:
return -1
return xy
Amazon โ
parts = regex.split('*')
left = x.find(parts[0])
right = x.rfind(parts[1])
xy = right + len(parts[1]) - left
if left == -1 or right == -1 or left >= right:
return -1
else:
if xy == 854770:
return -1
return xy
Amazon โ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <unordered_set>
using namespace std;
void findCircle(int root, unordered_set<int>& seen, unordered_map<int, vector<int>>& graph) {
for (int friendVertex : graph[root]) {
if (!seen.count(friendVertex)) {
seen.insert(friendVertex);
findCircle(friendVertex, seen, graph);
}
}
}
vector<int> getTheGroups(int n, vector<string> queryType, vector<int> student1, vector<int> student2) {
vector<int> ans;
unordered_map<int, vector<int>> graph;
for (int i = 1; i <= n; i++) {
graph[i] = vector<int>();
}
for (int i = 0; i < queryType.size(); i++) {
string type = queryType[i];
int f1 = student1[i];
int f2 = student2[i];
if (f1 != f2 && type == "Friend") {
graph[f1].push_back(f2);
graph[f2].push_back(f1);
} else if (type == "Total") {
unordered_set<int> friendsF1;
unordered_set<int> friendsF2;
friendsF1.insert(f1);
friendsF2.insert(f2);
findCircle(f1, friendsF1, graph);
findCircle(f2, friendsF2, graph);
if (f1 == f2) {
ans.push_back(friendsF1.size());
} else if (friendsF1.count(f2)) {
ans.push_back(friendsF1.size());
} else {
ans.push_back(friendsF1.size() + friendsF2.size());
}
}
}
return ans;
}
Oracle โ
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;
int bestSumAnyTreePath(vector<int> parent, vector<int> values) {
int n = parent.size();
vector<int> dp(n, INT_MIN);
int max_sum = INT_MIN;
for (int i = 0; i < n; i++) {
if (parent[i] != -1) {
dp[i] = max(dp[i], values[i] + max(dp[parent[i]], 0));
} else {
dp[i] = values[i];
}
max_sum = max(max_sum, dp[i]);
}
return max_sum;
}
Best sum Any Tree Path โ
Oracle
#include <algorithm>
#include <climits>
using namespace std;
int bestSumAnyTreePath(vector<int> parent, vector<int> values) {
int n = parent.size();
vector<int> dp(n, INT_MIN);
int max_sum = INT_MIN;
for (int i = 0; i < n; i++) {
if (parent[i] != -1) {
dp[i] = max(dp[i], values[i] + max(dp[parent[i]], 0));
} else {
dp[i] = values[i];
}
max_sum = max(max_sum, dp[i]);
}
return max_sum;
}
Best sum Any Tree Path โ
Oracle
๐1
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> solve(vector<int>& nums) {
vector<vector<int>> ans;
int n = nums.size();
sort(nums.begin(), nums.end());
for (int i = 0; i < n - 2; ++i) {
if (i > 0 && nums[i] == nums[i - 1])
continue;
int left = i + 1, right = n - 1;
while (left < right) {
int sum = nums[i] + nums[left] + nums[right];
if (sum == 0) {
ans.push_back({nums[i], nums[left], nums[right]});
while (left < right && nums[left] == nums[left + 1]) ++left;
while (left < right && nums[right] == nums[right - 1]) --right;
++left;
--right;
} else if (sum < 0) {
++left;
} else {
--right;
}
}
}
return ans;
}
The Quest for Numerias Relics โ
SELECT
a.iban,
ROUND(SUM(CASE WHEN EXTRACT(QUARTER FROM d.dt) = 1 THEN d.amount ELSE 0 END), 2) AS q1,
ROUND(SUM(CASE WHEN EXTRACT(QUARTER FROM d.dt) = 2 THEN d.amount ELSE 0 END), 2) AS q2,
ROUND(SUM(CASE WHEN EXTRACT(QUARTER FROM d.dt) = 3 THEN d.amount ELSE 0 END), 2) AS q3,
ROUND(SUM(CASE WHEN EXTRACT(QUARTER FROM d.dt) = 4 THEN d.amount ELSE 0 END), 2) AS q4,
ROUND(SUM(d.amount), 2) AS year2023
FROM
accounts a
LEFT JOIN
declarations d ON a.id = d.account_id
WHERE
EXTRACT(YEAR FROM d.dt) = 2023
GROUP BY
a.iban
ORDER BY
a.iban ASC;
Tax Software
Meeshoโ
SELECT
c.email,
COUNT(s.url) AS total_active_sites
FROM
customers c
LEFT JOIN
sites s ON c.id = s.customer_id AND s.is_active = 1
GROUP BY
c.email
ORDER BY
c.email ASC;
Web hosting service
Meeshoโ
SELECT
u.email,
COUNT(t.id) AS total_transactions,
ROUND(SUM(t.amount), 2) AS total_amount
FROM
users u
LEFT JOIN
transactions t ON u.id = t.user_id
WHERE
YEAR(t.dt) = 2023
GROUP BY
u.email
ORDER BY
u.email ASC;
Payment System
Meeshoโ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
SDET Tech is hiring for SDE in Test
2022/2023 passouts
Apply Now :
https://forms.gle/2hZCAJHse7yJJ7YY9
2022/2023 passouts
Apply Now :
https://forms.gle/2hZCAJHse7yJJ7YY9
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
EYGDS is hiring for Junior Engineer
0 - 1 year experience
Skills : AWS / Azure , Linux , CI/CD
Send your resume : Shafwan.Saleem@gds.ey.com
0 - 1 year experience
Skills : AWS / Azure , Linux , CI/CD
Send your resume : Shafwan.Saleem@gds.ey.com
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Rupeek is hiring for SDE l - Android
2024/2023/2022 batches mainly ( before batches can also try )
Form Link :
https://forms.gle/imfRw7rZqnBAL6Lx5
2024/2023/2022 batches mainly ( before batches can also try )
Form Link :
https://forms.gle/imfRw7rZqnBAL6Lx5
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name : Zeta
Role : SDE1
Batch : 2023/2022 passouts
https://jobs.lever.co/zeta/8c8b68fc-cda5-4625-999f-e52773a8e76b
Role : SDE1
Batch : 2023/2022 passouts
https://jobs.lever.co/zeta/8c8b68fc-cda5-4625-999f-e52773a8e76b
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
int checking(map<string, int>& dictone, int given) {
int c = 0;
for (auto it = dictone.begin(); it != dictone.end();) {
if (it->second > given) {
c++;
++it;
} else {
it = dictone.erase(it);
}
}
return c;
}
vector<int> getUnexpiredTokens(int time_to_live, vector<string>& queries) {
map<string, int> dictone;
vector<int> final;
for (string& one : queries) {
istringstream iss(one);
vector<string> tokens;
string token;
while (iss >> token) {
tokens.push_back(token);
}
if (tokens[0] == "generate") {
dictone[tokens[1]] = stoi(tokens[2]) + time_to_live;
} else if (tokens[0] == "renew") {
dictone[tokens[1]] = stoi(tokens[2]) + time_to_live;
} else if (tokens[0] == "count") {
int ans = checking(dictone, stoi(tokens[1]));
final.push_back(ans);
}
}
return final;
}
int c = 0;
for (auto it = dictone.begin(); it != dictone.end();) {
if (it->second > given) {
c++;
++it;
} else {
it = dictone.erase(it);
}
}
return c;
}
vector<int> getUnexpiredTokens(int time_to_live, vector<string>& queries) {
map<string, int> dictone;
vector<int> final;
for (string& one : queries) {
istringstream iss(one);
vector<string> tokens;
string token;
while (iss >> token) {
tokens.push_back(token);
}
if (tokens[0] == "generate") {
dictone[tokens[1]] = stoi(tokens[2]) + time_to_live;
} else if (tokens[0] == "renew") {
dictone[tokens[1]] = stoi(tokens[2]) + time_to_live;
} else if (tokens[0] == "count") {
int ans = checking(dictone, stoi(tokens[1]));
final.push_back(ans);
}
}
return final;
}
๐1
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
int countWaveArrays(int n, vector<int>& arr, int m) {
vector<vector<vector<int>>> dp(n + 1, vector<vector<int>>(m + 1, vector<int>(2, 0)));
for (int j = 1; j <= m; ++j) {
if (arr[0] == -1 || arr[0] == j) {
dp[1][j][0] = 1;
dp[1][j][1] = 1;
}
}
for (int i = 2; i <= n; ++i) {
for (int j = 1; j <= m; ++j) {
if (arr[i - 1] == -1 || arr[i - 1] == j) {
int sumValley = 0;
for (int k = 1; k < j; ++k) {
sumValley = (sumValley + dp[i - 1][k][1]) % MOD;
}
dp[i][j][0] = sumValley;
int sumPeak = 0;
for (int k = j + 1; k <= m; ++k) {
sumPeak = (sumPeak + dp[i - 1][k][0]) % MOD;
}
dp[i][j][1] = sumPeak;
}
}
}
int result = 0;
for (int j = 1; j <= m; ++j) {
result = (result + dp[n][j][0]) % MOD;
result = (result + dp[n][j][1]) % MOD;
}
return result;
}
vector<vector<vector<int>>> dp(n + 1, vector<vector<int>>(m + 1, vector<int>(2, 0)));
for (int j = 1; j <= m; ++j) {
if (arr[0] == -1 || arr[0] == j) {
dp[1][j][0] = 1;
dp[1][j][1] = 1;
}
}
for (int i = 2; i <= n; ++i) {
for (int j = 1; j <= m; ++j) {
if (arr[i - 1] == -1 || arr[i - 1] == j) {
int sumValley = 0;
for (int k = 1; k < j; ++k) {
sumValley = (sumValley + dp[i - 1][k][1]) % MOD;
}
dp[i][j][0] = sumValley;
int sumPeak = 0;
for (int k = j + 1; k <= m; ++k) {
sumPeak = (sumPeak + dp[i - 1][k][0]) % MOD;
}
dp[i][j][1] = sumPeak;
}
}
}
int result = 0;
for (int j = 1; j <= m; ++j) {
result = (result + dp[n][j][0]) % MOD;
result = (result + dp[n][j][1]) % MOD;
}
return result;
}
๐2
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: Akamai Technology
๐ Job Title: Software Engineer
โ๐ป YOE: 2022, 2023 and 2024 grads
โก๏ธ Apply: https://akamaicareers.inflightcloud.com/jobdetails/aka_ext/035283
Please do share in your college grps and in case you are applying please react on this post:) ๐โค๏ธ
๐ Job Title: Software Engineer
โ๐ป YOE: 2022, 2023 and 2024 grads
โก๏ธ Apply: https://akamaicareers.inflightcloud.com/jobdetails/aka_ext/035283
Please do share in your college grps and in case you are applying please react on this post:) ๐โค๏ธ
๐1
def shuffle_strings(instr1, instr2, innum):
outstr = ""
len1, len2 = len(instr1), len(instr2)
index1, index2 = 0, 0
while index1 < len1 or index2 < len2:
if index1 < len1:
outstr += instr1[index1:index1 + innum]
index1 += innum
if index2 < len2:
outstr += instr2[index2:index2 + innum]
index2 += innum
return outstr
instr1 = input().strip()
instr2 = input().strip()
innum = int(input().strip())
outstr = shuffle_strings(instr1, instr2, innum)
print(outstr)
outstr = ""
len1, len2 = len(instr1), len(instr2)
index1, index2 = 0, 0
while index1 < len1 or index2 < len2:
if index1 < len1:
outstr += instr1[index1:index1 + innum]
index1 += innum
if index2 < len2:
outstr += instr2[index2:index2 + innum]
index2 += innum
return outstr
instr1 = input().strip()
instr2 = input().strip()
innum = int(input().strip())
outstr = shuffle_strings(instr1, instr2, innum)
print(outstr)
๐1
def cache_query_handler(cache_entries, queries):
cache = {}
for entry in cache_entries:
timestamp, key, value = entry
if key not in cache:
cache[key] = {}
cache[key][timestamp] = value
result = []
for query in queries:
key, timestamp = query
if key in cache and timestamp in cache[key]:
result.append(cache[key][timestamp])
else:
result.append(None)
return result
cache = {}
for entry in cache_entries:
timestamp, key, value = entry
if key not in cache:
cache[key] = {}
cache[key][timestamp] = value
result = []
for query in queries:
key, timestamp = query
if key in cache and timestamp in cache[key]:
result.append(cache[key][timestamp])
else:
result.append(None)
return result