๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.61K subscribers
5.59K photos
3 videos
95 files
10.2K links
๐ŸšฉMain Group - @SuperExams
๐Ÿ“Job Updates - @FresherEarth

๐Ÿ”ฐAuthentic Coding Solutions(with Outputs)
โš ๏ธDaily Job Updates
โš ๏ธHackathon Updates & Solutions

Buy ads: https://telega.io/c/cs_algo
Download Telegram
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 โœ…
(Python 3)
public static void main (String[] args) throws java.lang.Exception
  {
        int tes=1;
      lable:while(tes-->0)
      {
            int n=sc.nextInt(),i,idx=0;
            long val[]=new long[n+1];
            for(i=1;i<=n;i++) val[i]=sc.nextLong();
            ArrayList<ArrayList<Integer>> arr=new ArrayList<>();
            for(i=0;i<=n;i++) arr.add(new ArrayList<>());
            long dp[]=new long[n+1];
            dp[1]=val[1];
            for(i=1;i<n;i++)
            {
                int x=sc.nextInt(),y=sc.nextInt();
                arr.get(x).add(y);
                arr.get(y).add(x);
            }
            dfs(arr,1,0,val); long max=0,min=0; boolean flag[]=new boolean[n+1];
            for(i=1;i<=n;i++)
            {
                if(arr.get(i).size()==1 && max<val[i])
                {
                    max=val[i]; flag[i]=true; flag[idx]=false; idx=i;
                }
            }
            for(i=2;i<=n;i++)
            {
                if(!flag[i]) min=Math.max(min,val[i]);
            }
            System.out.println(max+min);
        }
  }
    public static void dfs(ArrayList<ArrayList<Integer>> arr,int u,int p,long a[])
    {
        for(int it:arr.get(u))
        {
            if(it==p) continue;
            a[it]+=a[u];
        }
    }

De Shawโœ…
(Java8)
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();
}
#include <bits/stdc++.h>
using namespace std;

int main() {
    int t;
    cin >> t;
    while (t--) {
        int n, m, k, x, y;
        cin >> n >> m >> k >> x >> y;
        bool can_escape = true;
        for (int i = 0; i < k; i++) {
            int xi, yi;
            cin >> xi >> yi;
            int dx = abs(x - xi);
            int dy = abs(y - yi);
            if ((dx + dy) % 2 == 0) { // if Vika and friend are in same type of room
                can_escape = false;
            }
        }
        if (can_escape) {
            cout << "YES\n";
        } else {
            cout << "NO\n";
        }
    }
    return 0;
}
Codeforces Aโœ…
Please find latest Opportunities from Career page and Apply before Expired before applying kindly follow jobs description and eligibility carefully

passout year: 2023, 2022, 2021, 2020, 2019, 2018


Turing Hiring Frontend Developer ( Work from home)
Apply now : https://www.turing.com/remote-developer-jobs/j/li-promoted/front-end-engineer-134757-in?

MasterCard Hiring Software Engineer
Apply now: https://careers.mastercard.com/us/en/job/R-197293/Software-Engineer

Webomates Hiring Manul tester ( Work From home)
Apply now: https://www.webomates.com/manual-testing-engineer-3/

IBM Hiring Application Developers
Apply now : https://careers.ibm.com/job/18010338/application-developer-content-courseware-design-pune-in/

Tech Mahindra Hiring For Multiple Role
Apply now : https://registration.techmahindra.com/Candidate/RegDefault.aspx

Cornerstone Hiring For DevOps Engineer
Apply now: https://cornerstone.csod.com/ux/ats/careersite/2/home/requisition/8487

Citibank Hiring For Salesforce Developer
Apply now: https://jobs.citi.com/job/-/-/287/51626977392?

Parallel Hiring Junior Software Engineer
Apply now: https://jobs.lever.co/parallelwireless/d5392784-452b-4256-a1a1-80295828fd1a?

EY Hiring Manul tester
Apply now: https://careers.ey.com/ey/job/Tester/951240901

Schneider Electric Hiring Data Analyst
Apply now: https://careers.se.com/global/jobs/008J93?

GSK Hiring Junior Programmer
Apply now: https://jobs.gsk.com/en-gb/jobs/370251?

Deloitte Hiring Data Analyst
Apply now: https://usijobs.deloitte.com/careersUSI/JobDetail/USI-EH24-MF-ITS-CA-Off-Campus-Analyst/147196

Comcast Hiring SDE1
Apply now: https://jobs.comcast.com/jobs/description/regular?external_or_internal=External&job_id=R367806

Capgemini Hiring Service Desk Analyst
Apply now: https://www.capgemini.com/jobs/O17eRIkB_6fKCuLHYU9F/service-desk-analyst--1-to-3-years--mumbai/
๐Ÿ‘1
vector<long long>solution(int t,vector<vector<long long>>carPrices){
    vector<long long>ans;
     for(int i=0;i<t;i++){
         vector<long long>arr=carPrices[i];
         long long val = 0;
         long long mx = INT_MIN;
         int N=arr.size();
        for (int i = 0; i < N; i++) {
    
            long long curr = arr[i];
            mx = max(mx, curr);
            val = max(val, mx - curr);
        }
        long long res = 0;
        while ((1LL << res) - 1 < val) {
            ++res;
        }
        cout<<res<<endl;
        ans.push_back(res);
     }
     return ans;
}

Uber โœ…(Car)