๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.62K 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
def get_potential_of_winner(potential, k):
    curr = 1
    winner = 0
   
    while curr < k:
        if potential[0] > potential[1]:
            n = potential.pop(1)
            curr += 1
            potential.append(n)
        else:
            potential.pop(0)
            potential.append(winner)
            winner = 0
            curr = 1
   
    return potential[0]

IBMโœ…
๐Ÿ‘1
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

long long getNumPairs(vector<int>& arr, int l, int r) {
    sort(arr.begin(), arr.end());

    long long numPairs = 0;

    for (int i = 0; i < arr.size(); ++i) {
        auto low = lower_bound(arr.begin() + i + 1, arr.end(), l - arr[i]);
        auto high = upper_bound(arr.begin() + i + 1, arr.end(), r - arr[i]);

        numPairs += (high - low);
    }

    return numPairs;
}


IBMโœ…
๐Ÿ‘Ž2
def max_value(x, y, z):
    max_val = x

    for i in range(z):
        if x < y:
            x += 1
        elif x > y:
            x -= 1

        max_val = max(max_val, x)

    return max_val

IBMโœ