๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5000000;
int countPrimes(int N) {
if (N <= 2) {
return 0;
}
bitset<MAXN> isPrime;
isPrime.set();
isPrime[0] = isPrime[1] = 0;
for (int i = 2; i * i < N; ++i) {
if (isPrime[i]) {
for (int j = i * i; j < N; j += i) {
isPrime[j] = 0;
}
}
}
int count = 0;
for (int i = 2; i < N; ++i) {
if (isPrime[i]) {
++count;
}
}
return count;
}
SELECT MAX(months * hackos) AS maximum_hackos,Maximum total hackers
COUNT(*) AS number_of_hackers
FROM HACKER
WHERE months * hackos = (
SELECT MAX(months * hackos)
FROM HACKER
);
WITH combined_views AS (
SELECT 'Anonymous' AS user_type, id, start_dt, end_dt
FROM anonymous_viewers
UNION ALL
SELECT 'Subscribed' AS user_type, id, start_dt, end_dt
FROM subscribed_viewers
)
SELECT
user_type,
COUNT(DISTINCT id) AS unique_views,
COUNT(*) AS total_views
FROM combined_views
GROUP BY user_type
UNION ALL
SELECT
'Total' AS user_type,
COUNT(DISTINCT id) AS unique_views,
COUNT(*) AS total_views
FROM combined_views
ORDER BY
CASE
WHEN user_type = 'Anonymous' THEN 1
WHEN user_type = 'Subscribed' THEN 2
ELSE 3
END;
Meesho BAโ
๐1
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <bits/stdc++.h>
using namespace std;
unordered_map<int, string> stringMap;
void addString(int id, char c) {
stringMap[id] = string(1, c);
}
void concatStrings(int id1, int id2, int id3) {
stringMap[id3] = stringMap[id1] + stringMap[id2];
stringMap.erase(id1);
stringMap.erase(id2);
}
void reverseString(int id) {
reverse(stringMap[id].begin(), stringMap[id].end());
}
void getCharacter(int id, int k) {
cout << stringMap[id][k - 1] << endl;
}
void solve() {
int q;
cin >> q;
while (q--) {
int type;
cin >> type;
if (type == 1) {
int id;
char c;
cin >> id >> c;
addString(id, c);
} else if (type == 2) {
int id1, id2, id3;
cin >> id1 >> id2 >> id3;
concatStrings(id1, id2, id3);
} else if (type == 3) {
int id;
cin >> id;
reverseString(id);
} else if (type == 4) {
int id, k;
cin >> id >> k;
getCharacter(id, k);
}
}
}
int main() {
solve();
return 0;
}
String pool
Rubrik โ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
class KeyHierarchy:
def __init__(self):
self.gen = [1]
def rotate(self):
self.gen.append(1)
def rekey(self):
for i in range(len(self.gen)):
self.gen[i] += 1
def query(self, fam):
if 1 <= fam <= len(self.gen):
return self.gen[fam - 1]
return 0
def processOp(operations):
kh = KeyHierarchy()
results = []
for op in operations:
if op == 'Ro':
kh.rotate()
elif op == 'Re':
kh.rekey()
elif op.startswith('Q'):
family = int(op.split()[1])
results.append(kh.query(family))
return results
Key hierarchy โ
๐1
from collections import defaultdict
class BinaryTree:
def __init__(self, n):
self.n = n
self.tree = defaultdict(list)
self.values = [0] * (n + 1)
def add_edge(self, u, v):
self.tree[u].append(v)
self.tree[v].append(u)
def dfs(self, node, parent, depth, max_depth, increment):
if depth > max_depth:
return
self.values[node] += increment
for child in self.tree[node]:
if child != parent:
self.dfs(child, node, depth + 1, max_depth, increment)
def update(self, ui, di, xi):
self.dfs(ui, -1, 0, di, xi)
def solve(n, queries):
tree = BinaryTree(n)
for i in range(2, n + 1):
parent = i // 2
tree.add_edge(parent, i)
for ui, di, xi in queries:
tree.update(ui, di, xi)
return tree.values[1:]
Binary Tree updates โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
INDMoney is Hiring SDE Intern
Batch : 2023/2024/2025
Apply here: https://docs.google.com/forms/d/e/1FAIpQLSfP6cBiCXLLQ1rOSNePTDTHefMGSc6ijVDWm52MeHdiBbj-kQ/viewform
Batch : 2023/2024/2025
Apply here: https://docs.google.com/forms/d/e/1FAIpQLSfP6cBiCXLLQ1rOSNePTDTHefMGSc6ijVDWm52MeHdiBbj-kQ/viewform
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Quick Heal is hiring for Software Engineer I
Experience: 0 - 2 year's
Expected Salary: 6-10 LPA
Apply here: https://lifecycleqhtl.darwinbox.in/ms/candidate/careers/a666813b143a2f
Experience: 0 - 2 year's
Expected Salary: 6-10 LPA
Apply here: https://lifecycleqhtl.darwinbox.in/ms/candidate/careers/a666813b143a2f
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Spinta Digital is hiring for Software Engineer
Expected Salary: 6-12 LPA
Apply here:
https://www.linkedin.com/jobs/view/4001609045/
Expected Salary: 6-12 LPA
Apply here:
https://www.linkedin.com/jobs/view/4001609045/
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
nolano.ai is hiring for Machine Learning Intern (Remote)
Experience: 0 - 2 year's
Expected Stipend: โน20,000 โ โน80,000 Per months
Apply here:
https://wellfound.com/jobs/3080797-remote-machine-learning-intern-finetuning-and-benchmarking
Experience: 0 - 2 year's
Expected Stipend: โน20,000 โ โน80,000 Per months
Apply here:
https://wellfound.com/jobs/3080797-remote-machine-learning-intern-finetuning-and-benchmarking
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Hexaware Technologies Limited invites you to Superset to apply
for its Hexaware ||
2025 passout only
Complete the registration and apply!
Deadline to Apply: Aug 31, 2025 12:00 AM
Apply link : https://app.joinsuperset.com/join/#/signup/student?jp=033fcedb-1649-4dd5-bf7f-38f1772f1171
for its Hexaware ||
2025 passout only
Complete the registration and apply!
Deadline to Apply: Aug 31, 2025 12:00 AM
Apply link : https://app.joinsuperset.com/join/#/signup/student?jp=033fcedb-1649-4dd5-bf7f-38f1772f1171
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Need Java Developers (2023-24 Graduates), Dot Net Developers (Open to all Graduates) and Python Developers (2023-24 Graduates) for Fortune Cloud*๐ฅ๐ฅ๐ฅ
Package Details:
1-3 Months Training Period: Stipend- Rs. 10,000 (fixed) + Rs. 5000 (performance -based)
After Training, Salary: Rs. 3.6LPA
Date of Interview: 22.08.2024 @ 09:30 AM sharp.
Venue: B-1, 3rd Floor, Abhinav Apartment, Besides Congress House Rd, Shivajinagar, Pune, Maharashtra- 411005 (Near Rathson Traders, Congress Bhawan).
Package Details:
1-3 Months Training Period: Stipend- Rs. 10,000 (fixed) + Rs. 5000 (performance -based)
After Training, Salary: Rs. 3.6LPA
Date of Interview: 22.08.2024 @ 09:30 AM sharp.
Venue: B-1, 3rd Floor, Abhinav Apartment, Besides Congress House Rd, Shivajinagar, Pune, Maharashtra- 411005 (Near Rathson Traders, Congress Bhawan).
def find_unsorted_subarray_length(nums):
n = len(nums)
left = 0
while left < n - 1 and nums[left] <= nums[left + 1]:
left += 1
if left == n - 1:
return 0
right = n - 1
while right > 0 and nums[right] >= nums[right - 1]:
right -= 1
min_val = min(nums[left:right + 1])
max_val = max(nums[left:right + 1])
while left > 0 and nums[left - 1] > min_val:
left -= 1
while right < n - 1 and nums[right + 1] < max_val:
right += 1
length = right - left + 1
return length
nums_input = input()
nums_list = list(map(int, nums_input.split()))
output1 = find_unsorted_subarray_length(nums_list)
print(output1)
Arrange the heights
Apple โ
n = len(nums)
left = 0
while left < n - 1 and nums[left] <= nums[left + 1]:
left += 1
if left == n - 1:
return 0
right = n - 1
while right > 0 and nums[right] >= nums[right - 1]:
right -= 1
min_val = min(nums[left:right + 1])
max_val = max(nums[left:right + 1])
while left > 0 and nums[left - 1] > min_val:
left -= 1
while right < n - 1 and nums[right + 1] < max_val:
right += 1
length = right - left + 1
return length
nums_input = input()
nums_list = list(map(int, nums_input.split()))
output1 = find_unsorted_subarray_length(nums_list)
print(output1)
Arrange the heights
Apple โ
๐1
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <iostream>
#include <vector>
using namespace std;
#define ll long long
void solve(string x) {
ll n = x.size();
vector<vector<ll>> dp(n, vector<ll>(n, 0));
for (ll i = 0; i < n; i++) {
dp[i][i] = 1;
}
for (ll k = 1; k < n; k++) {
for (ll i = 0; i < n - k; i++) {
ll j = i + k;
if (x[i] == x[j]) {
dp[i][j] = 2 + dp[i + 1][j - 1];
} else {
dp[i][j] = max(dp[i][j - 1], dp[i + 1][j]);
}
}
}
ll ans = 0;
for (ll i = 0; i < n; i++) {
for (ll j = 0; j < n - 1; j++) {
ans = max(ans, dp[i][j] * dp[j + 1][n - 1]);
}
}
cout << ans;
}
int main() {
string input;
cin >> input;
solve(input);
return 0;
}
Game of sequence reverse
Apple โ
#include <vector>
using namespace std;
#define ll long long
void solve(string x) {
ll n = x.size();
vector<vector<ll>> dp(n, vector<ll>(n, 0));
for (ll i = 0; i < n; i++) {
dp[i][i] = 1;
}
for (ll k = 1; k < n; k++) {
for (ll i = 0; i < n - k; i++) {
ll j = i + k;
if (x[i] == x[j]) {
dp[i][j] = 2 + dp[i + 1][j - 1];
} else {
dp[i][j] = max(dp[i][j - 1], dp[i + 1][j]);
}
}
}
ll ans = 0;
for (ll i = 0; i < n; i++) {
for (ll j = 0; j < n - 1; j++) {
ans = max(ans, dp[i][j] * dp[j + 1][n - 1]);
}
}
cout << ans;
}
int main() {
string input;
cin >> input;
solve(input);
return 0;
}
Game of sequence reverse
Apple โ