๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.57K subscribers
5.58K photos
3 videos
95 files
10K 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 heapq
def reduce_sum(lst):
    heapq.heapify(lst)
    s = 0
    while len(lst) > 1:
        first = heapq.heappop(lst)
        second = heapq.heappop(lst)
        s += first + second
        heapq.heappush(lst, first + second)
    return s

Reduce the Array โœ…
All tc passed this code

def getResponses(valid_auth_tokens, requests):
    # Write your code here
    res = []
    for request in requests:
        rt,url = request
        params = url.split('?')[1].split('&')
        au = None
        csr = None
        for elon in params:
            key,value = elon.split('=')
            if key=='token':
                au = value
            elif key =='csrf':
                csr = value
        if au not in valid_auth_tokens:
            res.append("INVALID")
        elif rt=='POST' and (csr is None or not csr.isalnum() or len(csr)<8):
            res.append("INVALID")
        else:
            rss = "VALID"
            for elon in params:
                key,value = elon.split('=')
                if key!='token' and key!='csrf':
                    rss+=f",{key},{value}"
            res.append(rss)
    return res


Request Parser โœ…
๐Ÿ‘1
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int count_vowels(string str) {
    int count = 0;
    string vowels = "aeiou";
    for (char ch : str) {
        if (vowels.find(tolower(ch)) != string::npos) {
            count++;
        }
    }
    return count;
}

vector<string> determine_winner(vector<string> strings) {
    vector<string> winners;
    for (string str : strings) {
        if (count_vowels(str) == 0) {
            winners.push_back("Chris");
        } else {
            winners.push_back("Alex");
        }
    }
    return winners;
}. 

System and Strings
JPMC โœ…
int minimumKeypresses(string s) {
        unordered_map<char, int> counts;
        for (char ch : s) {
            counts[ch]++;
        }

        vector<int> frequencies;
        for (const auto& kvp : counts) {
            frequencies.push_back(kvp.second);
        }

        sort(frequencies.begin(), frequencies.end(), greater<int>());

        vector<int> remain {9, 9, 9};
        int i = 0, total = 0;
        for (int count : frequencies) {
            total += count * (i + 1);
            remain[i]--;
            if (remain[i] == 0) {
                i++;
            }
        }
       
        return total;
    }

Amazon โœ…
def processExecution(power, minPower, maxPower):
    result = []
    for min_p, max_p in zip(minPower, maxPower):
        count = sum(1 for p in power if min_p <= p <= max_p)
        power_sum = sum(p for p in power if min_p <= p <= max_p)
        result.append((count, power_sum))
    return result

Amazon โœ