๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.57K subscribers
5.59K photos
3 videos
95 files
10K 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
Hi All,
We, at Gartner, are hiring for Associate Services Business Analyst and Services Business Analyst for Gurugram location.

๐Ÿ“Œ Associate Services Business Analyst
- 0-3 years of overall experience in any related field
- Full-time graduation required
- Technical and non-technical backgrounds can apply

๐Ÿ“Œ Services Business Analyst
- 0-3 years of overall experience in any related field
- Full-time 2 years MBA/PGDM required
- Experience in strategies and business operations is an added advantage

NOTE: Candidates within the required experience range are encouraged to apply for the role.

Interested candidates can share their resume with me on garima.rai@gartner.com
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;

int solution(const vector<int>& start, const vector<int>& dest, const vector<int>& limit) {
    int N = start.size();
    int K = limit.size();
    int totalCost = 0, maxStation = 0;

    for (int i = 0; i < N; ++i) {
        maxStation = max(maxStation, max(start[i], dest[i]));
        totalCost += abs(start[i] - dest[i]) * 2 + 1;
    }

    if (maxStation >= K) return -1;
    return min(totalCost, limit[maxStation]);
}


MS Task 1โœ…
#include <vector>
#include <unordered_map>
#include <algorithm>
using namespace std;

void dfs(int node, unordered_map<int, vector<pair<int, int>>>& graph, vector<bool>& visited, int& count) {
    visited[node] = true;
    for (auto& neighbor : graph[node]) {
        int nextNode = neighbor.first;
        int direction = neighbor.second;
        if (!visited[nextNode]) {
            count += direction;
            dfs(nextNode, graph, visited, count);
        }
    }
}

int solution(vector<int> A, vector<int> B) {
    unordered_map<int, vector<pair<int, int>>> graph;
    int N = max(*max_element(A.begin(), A.end()), *max_element(B.begin(), B.end()));

    for (int i = 0; i < A.size(); i++) {
        graph[A[i]].push_back({B[i], 1});
        graph[B[i]].push_back({A[i], 0});
    }

    vector<bool> visited(N + 1, false);
    int count = 0;
    dfs(0, graph, visited, count);

    return count;
}


MS Task 2โœ