๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.52K subscribers
5.56K photos
3 videos
95 files
9.69K 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
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
string solve(string S) {
    string protocol, hostname, fileName = "", result = "";
    stringstream output;
    size_t pos = S.find("://");
    if (pos != string::npos) {
        protocol = S.substr(0, pos);
    }

    string rest = S.substr(pos + 3);
    pos = rest.find('/');
    if (pos != string::npos) {
        hostname = rest.substr(0, pos);
        rest = rest.substr(pos + 1);
    } else {
        hostname = rest;
        rest = "";
    }
    output << protocol << endl;
    output  << hostname << endl;
    size_t queryPos = rest.find('?');
    if (queryPos != string::npos) {
        fileName = rest.substr(0, queryPos);
        string query = rest.substr(queryPos + 1);
        if (!fileName.empty()) {
            output  << fileName << endl;
        }
        output << "Query parameters:" << endl;
        stringstream ss(query);
        string item;
        while (getline(ss, item, '&')) {
            size_t equalPos = item.find('=');
            if (equalPos != string::npos) {
                string key = item.substr(0, equalPos);
                string value = item.substr(equalPos + 1);
                output << "  " << key << ": " << value << endl;
            }
        }
    } else if (!rest.empty()) {
        output  << rest << endl;
    }

    result = output.str();
    return result;
}


URL Parser โœ…
Dunhunby
#include <iostream>
#include <cmath>
using namespace std;

long long ss(long long n) {
    long long sum = 0;

    if (n % 2 == 0) {
        sum += 2;
        while (n % 2 == 0) {
            n /= 2;
        }
    }

    for (long long i = 3; i <= sqrt(n); i += 2) {
        if (n % i == 0) {
            sum += i;
            while (n % i == 0) {
                n /= i;
            }
        }
    }
    if (n > 1) {
        sum += n;
    }

    return sum;
}

int main() {
    long long n;
    cin >> n;
    cout << ss(n) << endl;
    return 0;
}


Sum of prime factors โœ…
HSBC
SELECT l.id, l.title, l.rating, l.year
FROM library l
JOIN (
    SELECT year, MAX(rating) AS max_rating
    FROM library
    GROUP BY year
) AS year_max
ON l.year = year_max.year AND l.rating = year_max.max_rating
ORDER BY l.year ASC;

Book of the year โœ…
class UserMainCode(object):
    @classmethod
    def bestFibo(cls, input1):
        cnt = 0
        ans = 0

        for i in input1:
            if i == "H":
                ans += 2
                cnt += 1
            else: 
                ans -= 1

            if cnt >= 3:
                break

        return ans


Barco (FTE) โœ…
Toss and Score
long getMaxProfit(vector<int> pnl, int k) {
    int n = pnl.size();
    long maxprofit = 0;
    int i;
    long profit = 0;
    int start = 0;
    for(i=0;i<n;i++) {
        profit += pnl[i];
        if (profit <= 0) {
            profit = 0;
            start = i+1;
        } else {
            maxprofit = max(maxprofit , profit);
            if (i-start+1 == k) {
              
                profit -= pnl[start];
                start++;
            }
            while(pnl[start] <= 0 && start <=i) {
                profit -= pnl[start];
                maxprofit = max(maxprofit , profit);
                start++;
            }
        }
    }
    return maxprofit;
}



Profit Analysis โœ