๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.52K subscribers
5.56K photos
3 videos
95 files
9.7K 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
string parseURL(const string &url)
{
    string ans;
    string protocol;
    size_t pos = url.find("://");
    if (pos != string::npos)
    {
        protocol = url.substr(0, pos);
        ans += protocol;
    }

    string rest = url.substr(pos + 3);
    string hostname;
    pos = rest.find('/');
    if (pos != string::npos)
    {
        hostname = rest.substr(0, pos);
        ans += " ";
        ans += hostname;
        rest = rest.substr(pos + 1);
    }
    else
    {
        hostname = rest;
        ans += " ";
        ans += hostname;
        rest = "";
    }

    if (!rest.empty())
    {
        size_t query_pos = rest.find('=');
        string filename;
        if (query_pos != string::npos)
        {
            while (query_pos != string::npos)
            {
                filename = rest.substr(0, query_pos);
                string query = rest.substr(query_pos + 1);
                size_t temp = query.find('&');
                if (temp == string::npos)
                {
                    ans += " ";
                    ans += "[";
                    ans += filename;
                    ans+=":";
                ans+=" ";
                    ans += query;
                    ans += ']';
                    break;
                }
                string last = query.substr(0, temp);
                string last1 = query.substr(temp + 1);
                query_pos = last1.find('=');
                rest = last1;
                ans += " ";
                ans += "[";
               
                ans += filename;
                ans+=":";
                ans+=" ";
                ans += last;
                ans += ']';
            }
        }
        else
        {
           ans+=" ";
           ans+=rest;
        }
    }
    return ans;
}

URL Parser โœ…
Dunnhumby
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
using ll = long long;
using namespace std;
ll maxEvenSum(vector<ll>& t) {
    ll a = 0;
    ll s = INT_MAX;
    for (ll i : t) {
        a += i;
        if (i % 2 != 0) {
            s = min(s, i);
        }
    }
    if (a % 2 == 0) {
        return a;
    }
    return a- s;
}


Twilio โœ…
Company: Texas Instruments
Batch: 2022/2023/2024
Role: Software Engineer- AI & DL Location: Bangalore.

Skills: C/ C++, Machine learning/Deep Learning

Education: B.Tech/M.Tech 
Experience: 0.3 months - 22 months

Interested candidates email your profiles to namrata.kotur@spectrumconsultants.com
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
import sys
import threading

class FenwickTree:
    def __init__(self, size):
        self.n = size + 2
        self.tree = [0] * self.n
   
    def update(self, idx):
        while idx < self.n:
            self.tree[idx] += 1
            idx += idx & -idx
   
    def query(self, idx):
        res = 0
        while idx > 0:
            res += self.tree[idx]
            idx -= idx & -idx
        return res
       
def main():
    sys.setrecursionlimit(1 << 25)
    n = int(sys.stdin.readline())
    ranges = []
    for i in range(n):
        x, y = map(int, sys.stdin.readline().split())
        ranges.append((x, y, i))
   
    rangesSorted = sorted(ranges, key=lambda x: (x[0], -x[1]))
    endPoints = sorted(list(set([y for x, y, _ in rangesSorted])))
    yMapping = {y: idx+1 for idx, y in enumerate(endPoints)}
   
    ft = FenwickTree(len(yMapping))
    contains = [0] * n
   
    for x, y, idx in rangesSorted:
        contains[idx] = ft.query(len(yMapping)) - ft.query(yMapping[y]-1)
        ft.update(yMapping[y])
   
    rangesSortedRev = sorted(ranges, key=lambda x: (-x[0], x[1]))
   
    ftRev = FenwickTree(len(yMapping))
    containedBy = [0] * n
   
    for x, y, idx in rangesSortedRev:
        containedBy[idx] = ftRev.query(yMapping[y])
        ftRev.update(yMapping[y])
   
    print(' '.join(map(str, containedBy)))
    print(' '.join(map(str, contains)))

threading.Thread(target=main).start()


Kickdrum โœ