๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.52K subscribers
5.56K photos
3 videos
95 files
9.68K 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
import sys
sys.setrecursionlimit(10**6)
def countVerticalPaths(costs, edge_nodes, from_lst, to_lst, k):
    children = [[] for _ in range(edge_nodes)]

    for u, v in zip(from_lst, to_lst):
        u -= 1
        v -= 1
        children[u].append(v)
        children[v].append(u)

    prefixes = [0] * k
    prefixes[0] = 1

    def g(n, s, p, result):
        curr = (s + costs[n]) % k
        result[0] += prefixes[curr]
        prefixes[curr] += 1

        for c in children[n]:
            if c != p:
                g(c, curr, n, result)

        prefixes[curr] -= 1

    result = [0]
    g(0, 0, -1, result)

    return result[0]


DTCC HackTree โœ…
#include <vector>
using namespace std;

long long countSetBits(int number) {
    long long bitMask = 1, setBitsCount = 0;
    for (int bitPosition = 0; bitPosition < 32; bitPosition++) {
        long long quotient = number / (bitMask << (bitPosition + 1));
        long long remainder = number % (bitMask << (bitPosition + 1)) - (bitMask << bitPosition);
        setBitsCount += quotient * (bitMask << bitPosition);
        if (remainder > 0) setBitsCount += remainder;
        if (1 & (number >> bitPosition)) setBitsCount++;
    }
    return setBitsCount;
}

int solve(int targetCount) {
    if (targetCount == 0) return 1;
    int low = 1, high = 1e9 + 1;
    while (low < high) {
        int mid = (low + high) / 2;
        long long currentCount = countSetBits(mid);
        if (currentCount >= targetCount + 1) {
            high = mid;
        } else {
            low = mid + 1;
        }
    }
    return low;
}

vector<int> getValueAtIndices(const vector<int>& queries) {
    vector<int> results;
    for (int query : queries) {
        int result = solve(query);
        results.push_back(result);
    }
    return results;
}

DTCC female pass credits โœ…
MERN stack intern (backend focus: NodeJS) to join us for 3 months starting 15th July.

- prior experience building projects on NodeJS
- Work from office in Gurgaon
- Rs. 10K monthly stipend

If this is you, please reach out to me at garima@sploot.tech