๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.52K subscribers
5.56K photos
3 videos
95 files
9.67K 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
Hiring freshers for the role of Back-end Developer Internship.

Role: Software Developer Intern (Back-end Developer)
Company: UXDLAB Software Pvt. Ltd.
Location: Sector 62, Noida (On-site)
Working Days: 5 (Mon-Fri)
Duration of Internship: 6 months

Requirements:
Technical Skills - NodeJs, HTML, CSS, Javascript etc.
Education - B.Tech with Computer Science or MCA
Joining Availability - Immediate Joiner

Interested candidates can share their resume at naina@uxdlab.us
๐Ÿ“ŒAre you ready to kickstart your career in the tech world?

We're actively looking for passionate and talented individuals to join our team in the following roles:

๐Ÿ’ป AI/ML ๐——๐—ฒ๐˜ƒ๐—ฒ๐—น๐—ผ๐—ฝ๐—ฒ๐—ฟ (0-6 months experience)
๐Ÿ–ฅ๏ธ Python ๐——๐—ฒ๐˜ƒ๐—ฒ๐—น๐—ผ๐—ฝ๐—ฒ๐—ฟ (0-6 months experience)
๐ŸŒ ๐—ช๐—ผ๐—ฟ๐—ฑ๐—ฃ๐—ฟ๐—ฒ๐˜€๐˜€ ๐——๐—ฒ๐˜ƒ๐—ฒ๐—น๐—ผ๐—ฝ๐—ฒ๐—ฟ (0-6 months experience)
๐ŸŽจ ๐—ช๐—ฒ๐—ฏ ๐——๐—ฒ๐˜€๐—ถ๐—ด๐—ป๐—ฒ๐—ฟ (0-6 months experience)

๐Ÿ“ ๐—Ÿ๐—ผ๐—ฐ๐—ฎ๐˜๐—ถ๐—ผ๐—ป: Indore

๐Ÿ‘จ๐Ÿ’ป ๐—˜๐—น๐—ถ๐—ด๐—ถ๐—ฏ๐—ถ๐—น๐—ถ๐˜๐˜†: Freshers or candidates with up to 6 months of experience are welcome.

If you have the skills and enthusiasm to grow in a dynamic environment, weโ€™d love to hear from you!

๐Ÿ“ฉ ๐—›๐—ผ๐˜„ ๐˜๐—ผ ๐—”๐—ฝ๐—ฝ๐—น๐˜†: Send your resume to shikha.stevesai@gmail.com
typedef long long ll;

void solve() {

  ll n = N;
  vector<vector<ll>>arr(n, vector<ll>(3));
  for (int i = 0; i < n; i++) {
    arr[i] = {[0] = people[i] , [1] = starting[i] , [2] = ending[i]};
  }
  sort(arr.begin() , arr.end() , [&](vector<ll>& a , vector<ll>& b) {
    if (a[1] == b[1]) return a[2] < b[2];
    return a[1] < b[1];
  });

  ll sum = 0;
  for (auto& x : arr) sum += x[0];

  vector<ll>dp(n, -1);
  auto recurr = [&](ll i , auto && recurr)->ll{
    if (i >= n) return 0;

    ll& ans = dp[i];
    if (ans != -1) return ans; ans = 0;

    ans = recurr(i + 1 , recurr);
    ll low = i , high = n , val = arr[i][2];
    while (high - low > 1) {
      ll mid = (low + high) >> 1;
      if (val >=  arr[mid][1]) low = mid;
      else high = mid;
    }

    ans = max(ans, arr[i][0] + recurr( low + 1 , recurr) );

    return ans;
  };



  return sum - recurr(0, recurr);

}

Meeting Room โœ…
from collections import defaultdict, deque
def maxEqualGroups(a, b, c):
    d = defaultdict(list)
    for e, f in c:
        e -= 1
        f -= 1
        d[e].append(f)
        d[f].append(e)
    g = [-1] * a
    h = 0
    def bfs(i):
        j = deque([i])
        g[i] = 0
        k = [0, 0]
        k[0] += 1
        while j:
            l = j.popleft()
            m = g[l]
            for n in d[l]:
                if g[n] == -1:
                    g[n] = 1 - m
                    k[g[n]] += 1
                    j.append(n)
                elif g[n] == m:
                    return None
        return k
    for o in range(a):
        if g[o] == -1:
            p = bfs(o)
            if p is None:
                return 0
            h += min(p) * 2
    return h // 2


Two groups โœ…
vector<int>freq(1000002,0);
    int n = start.size();
    for(int i=0; i<n; i++) {
        freq[start[i]]++;
        freq[end[i]+1]--;
    }
    for(int i=1; i<=1000001; i++) freq[i] += freq[i-1];
    vector<int>temp;
    for(int i=1; i<=1000000; i++) {
        if(freq[i] >= k) temp.push_back(i);
    }
    vector<int>ans;
    int p = q_start.size();
    for(int i=0; i<p; i++) {
        auto x = lower_bound(temp.begin(),temp.end(),q_start[i])-temp.begin();
        auto y = upper_bound(temp.begin(),temp.end(),q_end[i])-temp.begin();
        ans.push_back(y-x);
    }
    return ans;

Valid Number โœ…
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
int findLowestPrice(vector<vector<string>> products, vector<vector<string>> discounts) {
    int cost = 0;
    map<string, int> mp;
    for (vector<string> &d : discounts) {
        string id = d[0];
        int gg = d[1][0] - '0';
        int disc = stoi(d[2]);
        if (gg == 0) {
            if (mp[id].find(0) == mp[id].end()) {
                mp[id][0] = disc;
            }
        }
        else {
            mp[id][0] = min(mp[id][0], disc);
        }
        else mp[id][gg]=max(mp[id][gg],disc);
    }
    for (vector<string> &p : products) {
        int price = stoi(p[0]), no_gravity12 = price;
        for (int i = 1; i < m; i++) {
            if (p[i] != "EMPTY") {
                string id = p[i];
                int d1 = mp[id][1];
                int d2 = mp[id][2];
                int price0 = mp[id].find(0) != mp[id].end() ? mp[id][0] : 0;
                int price1 = max(0, price - (d1 * price + 99)/100);
                int price2 = max(0, price - d2);
                gg = min(gg, price0, price1, price2);
            }
        }
        cost += gg;
    }
    return cost;
}

Shopping Cart Billing โœ…
vector<string> processLogs(vector<string> logs, int threshold) {
  unordered_map<string, int> transaction_cou
nt;

    for (const string& log : logs
) {
        istringstream iss(lo
g);
        string sender, recipie
nt;
        int amou
nt;
        iss >> sender >> recipient >> amou
nt;

    
 
        transaction_count[sender]
++;
    
 
        if (sender != recipient
) {
            transaction_count[recipient]
++;
     
}
 
  }

    vector<string> suspicious_use
rs;
    for (const auto& entry : transaction_count
) {
        if (entry.second >= threshold
) {
            suspicious_users.push_back(entry.firs
t);
     
}
 
  }


  sort(suspicious_users.begin(), suspicious_users.end(
));

    return suspicious_use
rs;
}

Suspicious activity from logs โœ…
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
int findMinWeight(vector<int> weights, int d) {

    priority_queue<int> maxHeap(weights.begin(), weights.end());

    for (int i = 0; i < d; ++i) {
        int maxWeight = maxHeap.top();
        maxHeap.pop();
        int remainingWeight = maxWeight / 2;
      maxHeap.push(maxWeight - remainingWeight);
    }

    int totalWeight = 0;
    while (!maxHeap.empty()) {
        totalWeight += maxHeap.top();
        maxHeap.pop();
    }
   
    return totalWeight;
}

Minimum total weight โœ…
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

class Solution {
public:
    int maximumInvitations(vector<int>& favourite) {
        int n = favourite.size();
        vector<bool> duoNode(n, false);
        vector<int> indegree(n, 0);
        vector<int> maxPathAt(n, 1);
       
        for (int i = 0; i < n; i++) {
            indegree[favourite[i]]++;
            if (favourite[favourite[i]] == i) {
                duoNode[i] = true;
                duoNode[favourite[i]] = true;
            }
        }
       
        int ans = 0;
        vector<bool> visited(n, false);
       
        for (int i = 0; i < n; i++) {
            if (!indegree[i]) {
                int cur = i;
                while (!duoNode[cur] && !visited[cur] && !indegree[cur]) {
                    visited[cur] = true;
                    maxPathAt[favourite[cur]] = max(maxPathAt[favourite[cur]], maxPathAt[cur] + 1);
                    cur = favourite[cur];
                    indegree[cur]--;
                }
            }
        }
       
        for (int i = 0; i < n; i++) {
            if (duoNode[i]) {
                ans += maxPathAt[i];
            }
        }
       
        int offset = 1;
        fill(maxPathAt.begin(), maxPathAt.end(), 0);
        fill(visited.begin(), visited.end(), false);
       
        for (int i = 0; i < n; i++) {
            if (!visited[i]) {
                int prev, cur = i;
                while (!maxPathAt[cur]) {
                    maxPathAt[cur] = offset++;
                    prev = cur;
                    cur = favourite[cur];
                }
                if (!visited[cur]) {
                    ans = max(ans, maxPathAt[prev] - maxPathAt[cur] + 1);
                }
                cur = i;
                while (!visited[cur]) {
                    visited[cur] = true;
                    cur = favourite[cur];
                }
            }
        }

        return ans;
    }
};

int main() {
    Solution solution;
    int N;
    cin >> N;
    vector<int> favourite(N);
   
    for (int i = 0; i < N; i++) {
        cin >> favourite[i];
        favourite[i]--;
    }

    int result = solution.maximumInvitations(favourite);
    cout << result << endl;

    return 0;
}

Barclays โœ…
#include <iostream>

using namespace std;

void cellCompete( int *arr, int days )
{
    int num = 0;
    for( int i = 0; i < 8; i++ )
    {
        num = ( num << 1 ) | arr[i];
    }

    for( int i = 0; i < days; i++ )
    {
        num = num << 1;
        num = ( ( ( num << 1 ) ^ ( num >> 1 ) ) >> 1 ) & 0xFF;
    }

    for( int i = 0; i < 8; i++ )
    {
        arr[i] = ( num >> 7 - i ) & 0x01;
    }
}

Pespico โœ