๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.63K subscribers
5.61K photos
3 videos
95 files
10.6K 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>
using namespace std;
#define int long long

long triplets(long t, vector<int> d) {
    int n = d.size();
    long count = 0;

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

    for (int i = 0; i < n - 2; ++i) {
        int j = i + 1;
        int k = n - 1;

        while (j < k) {
            int sum = d[i] + d[j] + d[k];
            if (sum <= t) {
                count += (k - j);
                ++j;
            }
            else {
                --k;
            }
        }
    }

    return count;
}


MSCI Triplets โœ…
SQL: Calendar Application Events Report 2(MSCI)โœ…
SELECT 
    e.dt,
    e.title,
    GROUP_CONCAT(CONCAT(g.full_name, ' <', g.email_address, '>') ORDER BY g.full_name SEPARATOR ', ') AS guests
FROM
    events e
JOIN
    events_guests eg ON e.id = eg.event_id
JOIN
    guests g ON eg.guest_id = g.id
WHERE
    g.on_vacation = 0
GROUP BY
    e.id, e.dt, e.title
ORDER BY
    e.dt ASC
LIMIT 5;
SELECT a.location, COUNT(f.flight_no) AS "Number of destination flights"
FROM airport a
JOIN flight f ON a.code = f.dest
GROUP BY a.location
HAVING COUNT(f.flight_no) > 0
ORDER BY COUNT(f.flight_no) DESC, a.location ASC;

AC flight sqlโœ…
def eulerTSieve(maxN):
    phi = list(range(maxN + 1))
    for i in range(2, maxN + 1):
        if phi[i] == i:
            for j in range(i, maxN + 1, i):
                phi[j] -= phi[j] // i
    return phi

def coprimeCount(A):
    maxN = 10**5
    phiValue = eulerTSieve(maxN)
   
    return [phiValue[num] for num in A]

IBM  coprime โœ…
def getValidWord(s, dictionary):
    def isSubSequence(word, string):
        it = iter(string)
        return all(c in it for c in word)
   
    validWords = [word for word in dictionary if isSubSequence(word, s)]
   
    if not validWords:
        return "-1"
   
    return min(validWords, key=lambda x: (len(x), x))


Glide typing โœ…
def getAnagramPeriod(s):
    n = len(s)
    for i in range(1, n + 1):
        if n % i == 0:
            period = s[:i]
            if sorted(period * (n // i)) == sorted(s):
                return i
    return n

IONโœ…
๐Ÿ‘1
vector<int> runningMedian(vector<int> arr) {
    priority_queue<int> low;
    priority_queue<int, vector<int>, greater<int>> high;
    vector<int> res;
   
    for (int num : arr) {
        low.push(num);
        high.push(low.top());
        low.pop();
        if (low.size() < high.size()) {
            low.push(high.top());
            high.pop();
        }
        res.push_back(low.top());
    }
    return res;
}

IONโœ…
long equalize(vector<long> power){
    sort(power.begin(), power.end());
    int n = power.size();
    long mid = power[n/2];
    long res = 0;

    for(int i=0;i<n;i++){
        res += abs(power[i] - mid);
    }
    return res;
}


IONโœ