๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
pair<ll, ll> dfs(int curr, int prv, const vector<vector<ll>>& adj, const vector<ll>& connect_val, int k) {
ll tmp = connect_val[curr - 1];
pair<ll, ll> ans = {tmp, tmp};
for (auto x : adj[curr]) {
if (x == prv) continue;
auto tmp = dfs(x, curr, adj, connect_val, k);
ans.second += tmp.second;
ans.first += tmp.first;
}
ans.first = max(ans.first, -static_cast<ll>(k));
return ans;
}
ll getmaximumefficiency(int connect_nodes, const vector<int>& connect_from, const vector<int>& connect_to, const vector<int>& connect_val, int k) {
vector<vector<ll>> adj(connect_nodes + 1);
for (int i = 0; i < connect_from.size(); i++) {
ll u = connect_from[i], v = connect_to[i];
adj[u].push_back(v);
adj[v].push_back(u);
}
vector<ll> connect_val_ll(connect_val.begin(), connect_val.end());
return dfs(1, 0, adj, connect_val_ll, k).first;
}
Gamekraft โ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
def lcs_length(a, b):
m, n = len(a), len(b)
dp = [[0] * (n + 1) for _ in range(m + 1)]
for i in range(1, m + 1):
for j in range(1, n + 1):
if a[i - 1] == b[j - 1]:
dp[i][j] = dp[i - 1][j - 1] + 1
else:
dp[i][j] = max(dp[i - 1][j], dp[i][j - 1])
return dp[m][n]
def min_steps_to_transform(current, desired):
L = lcs_length(current, desired)
n = len(current)
min_steps = n - L
return min_steps
UBSโ
m, n = len(a), len(b)
dp = [[0] * (n + 1) for _ in range(m + 1)]
for i in range(1, m + 1):
for j in range(1, n + 1):
if a[i - 1] == b[j - 1]:
dp[i][j] = dp[i - 1][j - 1] + 1
else:
dp[i][j] = max(dp[i - 1][j], dp[i][j - 1])
return dp[m][n]
def min_steps_to_transform(current, desired):
L = lcs_length(current, desired)
n = len(current)
min_steps = n - L
return min_steps
UBSโ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: Bureau
Batch eligible: 2025 and 2026 grads
Role: Engineering Intern
Apply: https://jobs.bureau.id/?ashby_jid=7d547bf9-e182-4fbc-b026-d92093fe757a
Role: DevOps Intern
Apply: https://jobs.bureau.id/?ashby_jid=fc951ad0-bdd1-4b36-b354-e3f8964aabda
Batch eligible: 2025 and 2026 grads
Role: Engineering Intern
Apply: https://jobs.bureau.id/?ashby_jid=7d547bf9-e182-4fbc-b026-d92093fe757a
Role: DevOps Intern
Apply: https://jobs.bureau.id/?ashby_jid=fc951ad0-bdd1-4b36-b354-e3f8964aabda
def getMaxTrafficTimes(start, end):
n = len(start)
start.sort()
end.sort()
ans, cmax, j = start[0], 1, 0
for i in range(1, n):
while end[j] < start[i]:
j += 1
if i - j + 1 > cmax:
cmax = i - j + 1
ans = start[i]
return ans
MSCI getmaxtraffic Time โ
n = len(start)
start.sort()
end.sort()
ans, cmax, j = start[0], 1, 0
for i in range(1, n):
while end[j] < start[i]:
j += 1
if i - j + 1 > cmax:
cmax = i - j + 1
ans = start[i]
return ans
MSCI getmaxtraffic Time โ
#include <bits/stdc++.h>
using namespace std;
#define int long long
long triplets(long t, vector<int> d) {
int n = d.size();
long count = 0;
sort(d.begin(), d.end());
for (int i = 0; i < n - 2; ++i) {
int j = i + 1;
int k = n - 1;
while (j < k) {
int sum = d[i] + d[j] + d[k];
if (sum <= t) {
count += (k - j);
++j;
}
else {
--k;
}
}
}
return count;
}
MSCI Triplets โ
SQL: Calendar Application Events Report 2(MSCI)โ
SELECT
e.dt,
e.title,
GROUP_CONCAT(CONCAT(g.full_name, ' <', g.email_address, '>') ORDER BY g.full_name SEPARATOR ', ') AS guests
FROM
events e
JOIN
events_guests eg ON e.id = eg.event_id
JOIN
guests g ON eg.guest_id = g.id
WHERE
g.on_vacation = 0
GROUP BY
e.id, e.dt, e.title
ORDER BY
e.dt ASC
LIMIT 5;
SELECT a.location, COUNT(f.flight_no) AS "Number of destination flights"
FROM airport a
JOIN flight f ON a.code = f.dest
GROUP BY a.location
HAVING COUNT(f.flight_no) > 0
ORDER BY COUNT(f.flight_no) DESC, a.location ASC;
AC flight sqlโ