๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.62K 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
#include <bits/stdc++.h>
#include <boost/icl/interval_set.hpp>
using namespace std;

vector<long long> solution(vector<vector<long long>>& chunks) {
    boost::icl::interval_set<long long> receivedBytes;
    vector<long long> result;
   
    for(auto &chunk: chunks) {
        receivedBytes.insert(boost::icl::discrete_interval<long long>::closed(chunk[0], chunk[1]));
        result.push_back(boost::icl::length(receivedBytes) - receivedBytes.iterative_size() + 1);
    }
    return result;
}

int main() {
    vector<vector<long long>> chunks = {{1, 9}, {1, 3}, {8, 15}, {6, 9}, {2, 3}};
    vector<long long> result = solution(chunks);
   
    for(auto res: result)
        cout << res << ' ';
    cout << '\n';
   
    return 0;
}

Counting Unique Bytes in Overlapping File Chunk
C++โœ…
#include<bits/stdc++.h>
using namespace std;

int minWealthDifference(vector<int>& c) {
    int totalWealth = accumulate(c.begin(), c.end(), 0);
    int n = c.size();
    int offset = n*10000;
    vector<vector<bool>> dp(n+1, vector<bool>(2*offset+1, false));

    dp[0][offset] = true;

    for(int i = 0; i < n; ++i){
        for(int j = i; j >= 0; --j){
            for(int k = 0; k <= 2*offset; ++k){
                if(dp[j][k]) {
                    dp[j+1][k+c[i]] = true;
                }
            }
        }
    }

    int result = INT_MAX;
    for(int i = 0; i <= 2*offset; ++i){
        if(dp[n/2][i]) {
            result = min(result, abs(totalWealth - 2*(i - offset)));
        }
    }
    return result;
}

int main() {
    int n;
    cin >> n;
    vector<int> c(n);
    for(int i = 0; i < n; ++i){
        cin >> c[i];
    }
    cout <<minWealthDifference(c) << "\n";

    return 0;
}

NATURE
C++โœ…
int solution(vector<int> arr, int src, int dest) {
    map<int,int> visA, visB;
    int start = arr[src];
    int curr = 1;
    set<int> s;

    for(auto &x: arr){
        s.insert(x);
    }

    while(visA[start] == 0){
        visA[start] = curr;
        curr++;
        start = arr[start];
        if(start == -1){
            break;
        }
    }
    start = arr[dest];

    while(visB[start] == 0){
        visB[start] = curr;
        curr++;
        start = arr[start];
        if(start == -1){
            break;
        }
    }

    vector<pair<int,int>> vp;
    for(auto &x: s){
        if(visA[x] != 0 && visB[x] != 0){
            pair<int,int> p = {visA[x] + visB[x], x};
            vp.push_back(p);
        }
    }

    sort(vp.begin(), vp.end());
    return vp[0].second;
}

Juspay Largest Sum Cycle
C++โœ…
int solution(vector<int>arr){
    int ans=INT_MIN;
    int result=-1;
    vector<int>weight(arr.size(),0);
    for(int i=0;i<arr.size();i++){
        int source=i;
        int dest=arr[i];
        if(dest!=-1){
            weight[dest]+=source;
            if(ans<=weight[dest]){
                ans=max(ans,weight[dest]);
                result=dest;
            }
           
        }
    }
    if(ans!=INT_MIN)
        return result;
    return -1;
}

Juspay Maximum Weight Node C++โœ…
int leastCommonDescendent(int nodes[], int N, int node1, int node2) {
    int *visited = new int [N];
    int cnt1 = 0;
    int cnt2 = 0;
    int mark = node1;

    if(node1 == node2) return node2;
    for(int i = 0; i < N; i++){
        visited[i] = 0;
    }

    while((nodes[node1] != node1) && (nodes[node1] != -1) && (visited[node1] == 0) && (node1 != node2)){
        visited[node1]++;
        node1 = nodes[node1];
        cnt1++;
    }

    visited[node1]++;

    while((nodes[node2] != node2) && (nodes[node2] != -1) && (visited[node2] != 2) && (node1 != node2)){
        visited[node2]++;
        node2 = nodes[node2];
        cnt2++;
    }

    if(node1 != node2) return -1;
    if ((nodes[node1] == -1) && (visited[node2] == 1)) return -1;
    if(nodes[node2] == -1) return -1;
    if(cnt1 > cnt2)
        return node2;
    else
        return mark;
}

Juspay Nearest Meeting Cell
C++โœ…
๐Ÿ‘1
#include <bits/stdc++.h>
using namespace std;

int main ()
{
  int64_t n, m, k; cin >> n >> m >> k;
  vector<pair<int64_t, int64_t>> pts(k);
  for (auto &[x, y] : pts)
    cin >> x >> y;

  int64_t r; cin >> r;
  int64_t t; cin >> t;
  int64_t rt = r*t;

  int64_t cnt = 0;
 
  for (int64_t x = 0; x <= n; x++) {
    for (int64_t y = 0; y <= n; y++) {
      bool burn = 0;
      for (auto [fx, fy] : pts) {
auto dx = x - fx;
auto dy = y - fy;

auto ri = dx*dx + dy*dy;
if (ri <= rt*rt) { burn = 1; break; }
      }
      //      cout << x << " " << y << endl;
      if (!burn) cnt++;
    }
  }
  cout << cnt << endl;

}


Spreading fire
Intuitโœ…
๐Ÿ‘1
#include <stdio.h>
#include <stdlib.h>

int min(int x, int y) { return x < y ? x : y; }
int max(int x, int y) { return x > y ? x : y; }

int n, m, t, fx, fy, ix, iy, jx, jy;

int vis[1005][1005];
bool solve(int x, int y, int t)
{
  if (x < 0 || y < 0) return 0;
  if (x >= m || y >= m) return 0;
  if (abs(x-fx) + abs(y - fy) <= t) return 0;
  if (x == jx && y == jy) return 1;
  if (vis[x][y] <= t) return 0;
  vis[x][y] = t;
  return solve(x+1, y, t+1)  solve(x-1, y, t+1)  solve(x, y+1, t+1) || solve(x, y-1, t+1);
}


int main() {

    scanf("%d %d", &n, &m);

    scanf("%d", &t);
   
    while (t--) {
      for (int i = 0; i <= n; i++) {
for (int j = 0; j <= m; j++) {
   vis[i][j] = 0x3f3f3f3f;
}
      }
     
        scanf("%d %d %d %d %d %d", &fx, &fy, &ix, &iy, &jx, &jy);
        bool res = solve(ix, ix, 0);
       
        if (!res) {
            printf("NO\n");
        } else {
            printf("YES\n");
        }
    }

    return 0;
}


Circus Fire 1โœ…
Company Name: Klimb.io
Role: FullStack Developer Internship
Batch eligible: 2023 and 2024 grads
Tech Stack: NodeJS, MongoDB, Angular, C/C++
Apply: https://bit.ly/45dDuZC

Company Name: BUSY Infotech
Role: Backend Developer Internship
Batch eligible: 2024 grads
Tech Stack: Python, Javascript, MySQL
Apply: https://bit.ly/3rXA137

Company Name: Whitecarrot
Role: FullStack Developer Internship
Batch eligible: 2024 grads
Tech Stack: NodeJS, TypeScript, HTML and CSS
Apply: https://bit.ly/47e8Lxl

P.S: Only go if you have knowledge of mentioned tech stack.
NVIDIA is hiring freshers as well as experienced candidates in the Hardware domain.

An online test will be conducted for the shortlisted candidates.
Eligibility:
Candidates with from an ASIC / Hardware background
(2020 / 2021 / 2022/ 2023 year of graduation)
Discipline: Bachelors / Masters - EE / ECE / VLSI /Microelectronics
Domains in which you will be working:

๏ปฟ๏ปฟASIC RTL Design Verification
๏ปฟ๏ปฟ๏ปฟSOC Performance Modeling / Boot Architecture
๏ปฟ๏ปฟ๏ปฟPhysical Design / Place and Route

Interested candidates can share their resume at
saurabkumar@nvidia.com
๐Ÿ‘1
๐Ÿš€ Elevate Your Career with our Live Career Preparation Online Masterclass!๐ŸŽ“

What's Inside:
๐Ÿ“˜ Freshersโ€™ Career Guidebook 2023
๐ŸŽฏ Step-by-step interview success plan
๐Ÿ“„ Building a standout Resume & LinkedIn profile
๐Ÿ”ฅ Proven strategies to secure your dream job

๐Ÿ“… Date & Time: Saturday, Aug 5th | 4:00 PM

๐ŸŽซ Reserve Your Spot NOW! (Hurry, limited seats!): https://bit.ly/3OH0Px7 ๐Ÿ†“๐ŸŽŸ๏ธ

Don't miss this chance to set the course for your career success! ๐Ÿš€๐ŸŽฏ
int countMinimumOperations(vector <int> arr) {
    int n = arr.size();
   
    vector <int> a(arr.begin(), arr.end());
    for(int i=0; i<n; i++) {
        a.push_back(arr[i]);
    }
   
    int ans = INT_MAX;
    for(int i=0; i<n; i++) {
        int cnt = 0, element = 1;
        for(int j=i; j<i+n; j++) {
            cnt += (a[j] != element);
            element++;
        }
       
        cnt = (cnt + 1) / 2;
        ans = min(ans, i + cnt);
    }
   
    return ans;
}

Count minimum operation โœ…
Atlassian