๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.63K 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
Weโ€™re looking for an ML/Python intern at smallest.ai to start immediately.

Great at - threads, processes, basic prompt engineering.

Should be quick to pick things up.

Need any one strong proof of work/excellence.

Location Indiranagar

Mail sudarshan@smallest.ai
โค1
int findMaximumGreatness( vector<int>&arr) {
    int n = arr.size()
    vector<int>v = arr;
    sort(begin(v), end(v));
    sort(begin(arr), end(arr));
    int ans = 0;
    int i = n - 1, j = n - 1;
    while (i >= 0 && j >= 0) {
        if (v[i] > arr[j]) {
            ans++;
            i--;
            j--;
        }
        else {
            j--;
        }
    }
    return ans;
}

UKG โœ…
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
const int MOD = 1000000007;
using namespace std;
void dfs(int node, const unordered_map<int, vector<pair<int, int>>>& tree, vector<long long>& magnitudes) {
    auto it = tree.find(node);
    if (it != tree.end()) {
        for (const auto& neighbor : it->second) {
            int next_node = neighbor.first;
            int weight = neighbor.second;
            magnitudes[next_node] = (magnitudes[node] * weight) % MOD;
            dfs(next_node, tree, magnitudes);
        }
    }
}

vector<int> findEquivalentMagnitude(int unit_nodes, vector<int> unit_from, vector<int> unit_to, vector<int> unit_weight, int x) {
    unordered_map<int, vector<pair<int, int>>> tree;
    for (int i = 0; i < unit_from.size(); ++i) {
        tree[unit_from[i]].emplace_back(unit_to[i], unit_weight[i]);
    }
    vector<long long> magnitudes(unit_nodes + 1, -1);
    magnitudes[1] = x;

    dfs(1, tree, magnitudes);

    vector<int> result(unit_nodes);
    for (int i = 1; i <= unit_nodes; ++i) {
        result[i - 1] = magnitudes[i];
    }

    return result;
}

UKGโœ…
๐Ÿ‘1
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
public static int countMeetings(int[] firstDay, int[] lastDay) {
        int n = firstDay.length;
        TreeSet<Integer> availableDays = new TreeSet<>();
        for (int i = 1; i <= 100000; i++) {
            availableDays.add(i);
        }
       
        int count = 0;
        for (int i = 0; i < n; i++) {
            int start = firstDay[i];
            int end = lastDay[i];
            Integer day = availableDays.ceiling(start);
            if (day != null && day <= end) {
                count++;
                availableDays.remove(day);
            }
        }
       
        return count;
    }

Standard chartered โœ