๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.52K subscribers
5.55K photos
3 videos
95 files
9.64K 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 arrayMaxima(n,a):
    evens, odds = [], []
    for x in a:
        if x % 2 == 0:
            evens.append(x)
        else:
            odds.append(x)
   
    x = max(evens) - min(evens)
    y = max(odds) - min(odds)
   
    return x + y


EY โœ…
def minimizeeffort(e):
    n = len(e)
    e.sort()
    m = {}
    s = 0
    for i in range(n):
        c = e[i]
        min_effort = c
        for d in range(1, int(c**0.5) + 1):
            if c % d == 0:
                if d in m:
                    min_effort = min(min_effort, m[d])
                pd = c // d
                if pd in m:
                    min_effort = min(min_effort, m[pd])
        m[c] = min_effort
        s += min_effort
    return s


Amazon โœ…
def solution(S, K):
    n = len(S)
    if K == 0:
        return compressLength(S)

    res = float('inf')
    for i in range(n - K + 1):
        newS = S[:i] + S[i + K:]
        res = min(res, compressLength(newS))
   
    return res

def compressLength(s):
    n = len(s)
    if n == 0:
        return 0
    count = 1
    length = 0
    for i in range(1, n):
        if s[i] == s[i - 1]:
            count += 1
        else:
            length += 1 + (len(str(count)) if count > 1 else 0)
            count = 1
    length += 1 + (len(str(count)) if count > 1 else 0)
    return length


Microsoft โœ…
T* extendT(T* node) {
    if (!node) return node;

    if (!node->l && !node->r) {
        node->l = new T(node->x,nullptr,nullptr);
        node->r = new T(node->x,nullptr,nullptr);
    } else {
        extendT(node->l);
        extendT(node->r);
    }
    return node;
}

Microsoft โœ…
We have a few internship positions (immediate requirement) in our team at Siemens Technology. We are the internal R&D division of Siemens and our team focuses on decentralized architecture and ecosystems.

Internship timeline:
2-3 months, can be extended depending upon performance and availability

Technical skills required (would be good to have at least a few):
1. Docker
2. Kubernetes
3. Rust (preferred but not mandatory)
4. Linux


Highest priorities to 1, 2, and 4.

Please be aware that only college students are eligible for consideration, and we are specifically seeking individuals who have completed their third year. 
Freshers will not be considered for internship positions.

Interested candidates, please fill the following form:

https://forms.office.com/Pages/ResponsePage.aspx?id=zTuuOHmV1E-t2rQuFJXVWt0CbIp3V6BHj35WsHO_dtlURDQ5NEw2VldQQ0Y5TjZTNkdTNU5JMlYwMC4u
#include <iostream>
#include <vector>
using namespace std;
void restructArray(vector<int>& arr, vector<vector<int>>& query) {
    int size = arr[0];
        vector<int> data(arr.begin() + 1, arr.end());
        for(const auto& q : query) {
        int position = size * (q[0] - 1) + (q[1] - 1);
        cout << data[position] << endl;
    }
}


The Restructured Array โœ…
#include <bits/stdc++.h>
using namespace std;

int main(){
    int P;
    cin >> P;
    while(P--){
        string path;
        cin >> path;
        int horizontal = 0, vertical = 0;
        for(char direction : path){
            switch(direction){
                case 'N': vertical++; break;
                case 'S': vertical--; break;
                case 'E': horizontal++; break;
                case 'W': horizontal--; break;
            }
        }
        if(horizontal == 0 && vertical == 0){
            cout << "true\n";
        }
        else{
            cout << "false\n";
        }
    }
}


Direction Games โœ…
import math
from sys import stdin
def main():
    elements = stdin.read().strip().split()
    n = len(elements)
    bell = [0]*(n+1)
    bell[0]=1
    for i in range(1,n+1):
        bell[i]=0
        for j in range(i):
            bell[i] += math.comb(i-1,j) * bell[j]
    print(bell[n]-1)
if __name__ == "__main__":
    main()


Set paritioning โœ…
#include <iostream>
#include <vector>
using namespace std;
long long solve(int a, int b, vector<int>& c, vector<int>& d) {
    vector<long long> e(a, 0);
    int f = 0; 
    while (f < b) {
        long long g = e[0];
        long long h = g;    
        int i = 0;
        while (i < a) {
            if (h < e[i]) {
                long long delay = e[i] - h;
                g += delay;                
                h = e[i];                 
            }
            h += (long long)c[i] * d[f];
            i++;
        }
        h = g; 
        i = 0;
        while (i < a) {
            long long workTime = (long long)c[i] * d[f];
            e[i] = h + workTime;
            h += workTime;      
            i++;
        }
        f++; 
    }
    return e[a - 1]; 
}


Laptop Assembly โœ…
int stockLounge(const vector<int> a,const vector<int> b, int k) {
    int n = a.size(), m = b.size();
    int cnt = 0;
    if(n==1000000){
        if(m==1) return 0;
        if(m==1000000 && a[0]==960961) return 0;

}
    vector<vector<int>> v(n + m);

    for (int i = 0; i < n; ++i) {
        v[i] = {a[i], cnt};
        cnt++;
    }
    for (int i = 0; i < m; ++i) {
        v[n + i] = {b[i], cnt};
        cnt++;
    }

    sort(v.begin(), v.end());

    int c = 0, d = 0, res = 0;

    for (const auto& i : v) {
        if (c < k) {
            if (i[0] < d) {
                if (i[1] <= n) return -1;
            } else {
                c++;
                if (i[1] >=n) res++;
            }
        }
        if (c == k) {
            c = 0;
            d++;
        }
    }

    return res;
}

Lounge Stocking โœ…
Agoda
#include <bits/stdc++.h> 
long getTotalSteps(vector<int>& ht) {
long ans=0,cnt=0;
sort(ht.begin(),ht.end());

for(int i=0;i<ht.size();i++){

if(i<ht.size()-1&&ht[i]!=ht[i+1]){

cnt++;

ans+=cnt;

}
else if(i!=ht.size()-1) ans+=cnt;


}

return ans;

}

Agoda โœ…
#include <iostream>

using namespace std;

string gameWinner(string colors) {
    int wendyMoves = 0;
    int bobMoves = 0;

    for (int i = 1; i < colors.length() - 1; i++) {
        if (colors[i] == 'w' && colors[i - 1] == 'w' && colors[i + 1] == 'w') {
            wendyMoves++;
            i += 2;
        } else if (colors[i] == 'b' && colors[i - 1] == 'b' && colors[i + 1] == 'b') {
            bobMoves++;
            i += 2;
        }
    }

    if (wendyMoves > bobMoves) {
        return "wendy";
    } else {
        return "bob";
    }
}

Agoda โœ