๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.52K subscribers
5.56K photos
3 videos
95 files
9.65K 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
I am not sure if you guys are aware or not but there are many scammers in Telegram who may ask you to pay them 200 rs and will give 1250 after sometime, never ever reply to those fraud people. Never ever pay any money to anyone in telegram for the sake of getting it double or whatsoever.
Be smart, stay safe โค๏ธ
#include <iostream>
#include <vector>
#include <unordered_map>
#include <set>
#include <algorithm>
using namespace std;
long long minimumCost(vector<int>& arr) {
    unordered_map<int, int> freq;
    for (int num : arr) {
        freq[num]++;
    }
    vector<pair<int, int>> elements;
    for (const auto& entry : freq) {
        elements.push_back(entry);
    }
    sort(elements.begin(), elements.end(), [](pair<int, int>& a, pair<int, int>& b) {
        return a.second > b.second;
    });
    set<int> distinct;
    long long totalCost = 0;
    for (const auto& element : elements) {
        for (int i = 0; i < element.second; ++i) {
            distinct.insert(element.first);
            totalCost += distinct.size();
        }
    }
    return totalCost;
}


IBM โœ…
SELECT product_name, cost AS product_cost, category AS product_category
FROM products AS p1
WHERE cost = (
    SELECT MAX(cost)
    FROM products AS p2
    WHERE p1.category = p2.category
)
ORDER BY product_cost DESC, product_name ASC;

Fractalโœ…
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
public static int countHashtagDivisors(String description1, String description2) {
        int len1 = description1.length();
        int len2 = description2.length();
        int gcdLength = gcd(len1, len2);
       
        int commonDivisors = 0;
        for (int i = 1; i <= gcdLength; i++) {
            if (gcdLength % i == 0) {
                String candidate = description1.substring(0, i);
                if (isValidDivisor(description1, candidate) && isValidDivisor(description2, candidate)) {
                    commonDivisors++;
                }
            }
        }
        return commonDivisors;
    }

    public static int gcd(int a, int b) {
        while (b != 0) {
            int temp = b;
            b = a % b;
            a = temp;
        }
        return a;
    }

    public static boolean isValidDivisor(String description, String candidate) {
        int len = description.length();
        int candLen = candidate.length();
        if (len % candLen != 0) return false;
       
        StringBuilder repeated = new StringBuilder();
        for (int i = 0; i < len / candLen; i++) {
            repeated.append(candidate);
        }
        return repeated.toString().equals(description);
    }

Hashtag divisor count โœ…
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
#include <cctype>

using namespace std;
string sanitize(string s) {
    string result;
    for (char c : s) {
        if (isalnum(c)) { 
            result += tolower(c); 
        }
    }
    return result;
}

vector<string> generate_usernames(vector<string> names) {
    unordered_map<string, int> username_count; 
    vector<string> usernames;
   
    for (string full_name : names) {
        vector<string> words;
        string word;
        for (char c : full_name) {
            if (c == ' ') {
                if (!word.empty()) words.push_back(word);
                word = "";
            } else {
                word += c;
            }
        }
        if (!word.empty()) words.push_back(word);
                string given_name = sanitize(words[0]);
        string family_name = sanitize(words.back());
                string username = family_name.substr(0, min(7, (int)family_name.length()));
        int remaining_len = 8 - username.length();
       
        if (remaining_len > 0) {
            username += given_name.substr(0, min(remaining_len, (int)given_name.length()));
        }
                string final_username = username;
        int counter = 1;
       
        while (username_count.find(final_username) != username_count.end()) {
            if (final_username.length() < 8) {
                final_username = username + to_string(counter);
            } else {
                final_username = username.substr(0, 7) + to_string(counter);
            }
            counter++;
        }
                username_count[final_username]++;
        usernames.push_back(final_username);
    }
   
    return usernames;
}



Company Username โœ…
Squarepoint
public static int solution(int[] objects, int radius) {
        int n = objects.length;
        int maxIlluminated = 0;
        int bestPosition = Integer.MAX_VALUE;
        int left = 0;

        for (int right = 0; right < n; right++) {
            while (objects[right] - objects[left] > 2 * radius) {
                left++;
            }

            int count = right - left + 1;

            int candidatePosition = objects[right] - radius;
            candidatePosition = Math.max(candidatePosition, objects[left]);

            if (count > maxIlluminated) {
                maxIlluminated = count;
                bestPosition = candidatePosition;
            } else if (count == maxIlluminated) {
                bestPosition = Math.min(bestPosition, candidatePosition);
            }
        }

        return bestPosition;
    }

Coinbase (FTE) โœ