ATS resume help
Відкрити в Telegram
WhatsApp Me https://wa.me/917674087200 ✅ ATS-Friendly Resumes ✅ Higher Interview Calls ✅ Free Tips + Templates
Показати більше3 730
Підписники
-324 години
-167 днів
-4730 днів
Архів дописів
3 730
#include<bits/stdc++.h>
using namespace std;
int closestToTarget(vector<int> oxygenLevels, int target)
{
int current_AND_value = oxygenLevels[0];
int best_diff = abs(current_AND_value - target);
unordered_map<int, int> window_bit_counts;
int num = oxygenLevels[0];
for (int j = 0; j < 32; j++)
{
if (num & (1 << j))
{
window_bit_counts[j]++;
}
}
int left_idx = 0, right_idx = 0;
while (right_idx < oxygenLevels.size())
{
if (current_AND_value > target || left_idx > right_idx)
{
right_idx++;
if (right_idx >= oxygenLevels.size())
{
break;
}
int num = oxygenLevels[right_idx];
for (int j = 0; j < 32; j++)
{
if (num & (1 << j))
{
window_bit_counts[j]++;
}
}
// cout<<"right_idx: "<<right_idx<<endl;
}
else
{
int num = oxygenLevels[left_idx];
for (int j = 0; j < 32; j++)
{
if (num & (1 << j))
{
window_bit_counts[j]--;
}
}
left_idx++;
}
current_AND_value = 0;
for (auto it = window_bit_counts.begin(); it != window_bit_counts.end(); it++)
{
if (it->second == right_idx - left_idx + 1)
{
current_AND_value += (1 << it->first);
}
}
if (left_idx <= right_idx)
{
best_diff = min(best_diff, abs(current_AND_value - target));
}
}
return best_diff;
}
Optimum oxygen code
Salesforce ✅
3 730
int closestToTarget(vector oxygenLevels, int target) {
int n = oxygenLevels.size();
int minDiff = abs(oxygenLevels[0] - target); // Initialize the minimum difference with the first oxygen level
// Iterate through the oxygen levels to find the minimum difference
for (int i = 1; i < n; i++) {
int diff = abs(oxygenLevels[i] - target);
minDiff = min(minDiff, diff);
}
return minDiff;
}
Optimum oxygen
Salesforce ✅
3 730
#include<bits/stdc++.h>
typedef double C;
typedef complex<C> P;
#define X real()
#define Y imag()
P a[205];
int n, x, y, k;
bool check(int r){
int c=0;
for(int i = 0; i < n; i++){
for(int j = i+1; j < n; j++){
P g = a[j] - a[i];
double d = abs(g);
if(d > 2*r) continue;
P mid = (a[i] + a[j]) * (1.0/2);
double h = sqrt(r*1.0*r - d*d/4);
P per = P(-g.Y,g.X) * (h/d);
int c1 = 2, c2 = 2;
for(int l = 0; l < n; l++){
if(l == i or l == j) continue;
if(abs(a[l] - (mid-per)) <= r)
c1++;
if(abs(a[l] - (mid+per)) <= r)
c2++;
}
c=max({c,c1,c2});
}
}
return c>=k;
}
int Solution::solve(vector<vector<int> > &A, int B ) {
n = A.size();
for(int i = 0; i < n;i++)
a[i] = {1.0*A[i][0], 1.0*A[i][1]};
k = B;
int l = 1, h = 2000000000, ans;
while(h >= l){
int m = (l+h)/2;
if(check(m)) {
ans = m;
h = m-1;
}
else l = m+1;
}
return ans;
}
Red Zone
Media. Net ✅
3 730
Accenture 20th 21st 22nd (10am 2pm 6pm) All slots Exam help available ✅😁
Contact @placementsBro
Note: its paid help
Only one slots left
💯 Clearance and genuine help
Scroll up and check all pinned proofs 😎💯
Remote access also available 😁
3 730
Amazon, HCl, Accenture, KPIT , Cisco, TechM, Zoho or Any Oncampus or Offcampus Exam help available✅😁
Contact @placementsBro😎
Note: its paid help
💯 Clearance and genuine help
Scroll up and check all pinned proofs 😎💯
Remote access also available 😁
3 730
Median Path (Google) ✅
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <class T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
struct Median
{
priority_queue<int> max_heap;
priority_queue<int, vector<int>, greater<int>> min_heap;
void add(int x)
{
if (max_heap.empty() || x <= max_heap.top())
max_heap.push(x);
else
min_heap.push(x);
if (max_heap.size() > min_heap.size() + 1)
{
min_heap.push(max_heap.top());
max_heap.pop();
}
else if (min_heap.size() > max_heap.size())
{
max_heap.push(min_heap.top());
min_heap.pop();
}
}
int get()
{
return max_heap.top();
}
};
void solve()
{
int n;
cin >> n;
vector<int> a(n);
for (auto &x : a)
cin >> x;
vector<vector<int>> g(n);
for (int i = 0; i < n - 1; i++)
{
int u, v;
cin >> u >> v, u--, v--;
g[u].push_back(v);
g[v].push_back(u);
}
oset<pair<int, int>> s;
long ans = 0;
function<void(int, int, int)> dfs = [&](int u, int p, int d)
{
s.insert({a[u], u});
if (d & 1)
ans += s.find_by_order((d - 1) / 2)->first;
for (auto v : g[u])
if (v != p)
dfs(v, u, d + 1);
s.erase({a[u], u});
};
dfs(0, -1, 1);
cout << ans << '\n';
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int t;
cin >> t;
while (t--)
solve();
}
3 730
def solve(i, num, n, k, arr, cost, dp, pf):
if i == n:
return 0
if dp[i][num] != -1:
return dp[i][num]
ans = float('inf')
for j in range(1, n):
sum_val = arr[i] + k * num
sum_val += pf[j+1] - pf[i]
ans = min(ans, sum_val + solve(i+1, num+1, n, k, arr, cost, dp, pf))
dp[i][num] = ans
return ans
def getMinCost(arr, cost, k):
n = len(arr)
for i in range(1, n):
arr[i] += arr[i - 1]
pf = [0] * (n + 1)
for i in range(1, n):
pf[i] = pf[i-1] + cost[i - 1]
dp = [[-1] * (n + 1) for _ in range(n)]
return solve(0, 0, n, k, arr, cost, dp, pf)
De Shaw ✅
