๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.52K subscribers
5.56K photos
3 videos
95 files
9.66K 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
int solution(int n,vector<int>nums){
  priority_queue<long long, vector<long long>, greater<long long> > pq;
  long long S = 0;
 
  for(int i = 1;i <= n;i++){
    int x=nums[i-1];
    S += x;
    pq.push(x);
   
    while(S < 0){
      S -= pq.top();
      pq.pop();
    }
  }
 
  return (int) pq.size();
    }


// Axis bank positive totalโœ…
class Solution {
public:
    int helper(vector<int> &nums, int k){
        int frequency = 0, ans = 0; ;
        map<int, int> mapping;
        for(int i = 0; i < nums.size(); ++i){
            ans += nums[i];
            if(ans == k){
                frequency++;
            }
            if(mapping.find(ans - k) != mapping.end()){
                frequency += mapping[ans - k];
            }
            mapping[ans]++;
        }
        return frequency;
    }
    int numSubmatrixSumTarget(vector<vector<int>>& matrix, int target) {
        int count = 0;
        for(int i = 0; i < matrix.size(); ++i){
            vector<int> result(matrix[0].size(), 0);
            for(int j = i; j < matrix.size(); ++j){
                for(int k = 0; k < matrix[0].size(); ++k){
                    result[k] += matrix[j][k];
                }
                count += helper(result, target);
            }
        }
        return count;
    }
};



Barclays โœ…
#include <iostream>
#include <vector>
#include <climits>

using namespace std;

int minCost(int N, int X, int Y, vector<int>& happiness, vector<int>& weight, vector<int>& cost) {
    vector<vector<int>> dp(X + 1, vector<int>(Y + 1, INT_MAX));
    dp[0][0] = 0;
    for (int i = 0; i < N; ++i) {
    for (int h = X; h >= 0; --h) {
    for (int w = Y; w >= weight[i]; --w) {
    if (dp[h][w - weight[i]] != INT_MAX) {
    int newH = min(X, h + happiness[i]);
    dp[newH][w] = min(dp[newH][w], dp[h][w - weight[i]] + cost[i]);
    }
    }
    }
    }
    int minCost = INT_MAX;
    for (int w = 0; w <= Y; ++w) {
        minCost = min(minCost, dp[X][w]);
    }

    return minCost;
}


Shopping mall โœ…
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_set>
using namespace std;
void bfs(int start, vector<vector<int>>& graph, vector<bool>& visited) {
    queue<int> q;
    q.push(start);
    visited[start] = true;
    while (!q.empty()) {
    int node = q.front();
    q.pop();
    for (int neighbor : graph[node]) {
    if (!visited[neighbor]) {
    visited[neighbor] = true;
    q.push(neighbor);
            }
        }
    }
}
int solve(int N, vector<pair<int, int>>& friends) {
vector<vector<int>> graph(N + 1);
for (auto& edge : friends) {
int u = edge.first, v = edge.second;
graph[u].push_back(v);
graph[v].push_back(u);
    }
vector<bool> visited(N + 1, false);
int components = 0;
for (int i = 1; i <= N; ++i) {
if (!visited[i]) {
bfs(i, graph, visited);
++components;
}
}
return components - 1;
}


Friendship Relation โœ…
import java.util.*;
public class Main {
    static int programmerStrings(String s) {
        String programmer = "programmer";
        String head = programmer;
        int i = 0;
        for (; i < s.length(); i++) {
            int pIndex = head.indexOf(s.charAt(i));
            if (pIndex != -1) {
                head = head.substring(0, pIndex) + head.substring(pIndex + 1);
            }

            if (head.length() == 0) {
                i++;
                break;
            }
        }
        String tail = programmer;
        int j = s.length() - 1;
        for (; j >= 0; j--) {
            int pIndex = tail.indexOf(s.charAt(j));
            if (pIndex != -1) {
                tail = tail.substring(0, pIndex) + tail.substring(pIndex + 1);
            }

            if (tail.length() == 0) {
                j--;
                break;
            }
        }

        return j - i + 1;
    }


Cashfree โœ…
Programmer string
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 โœ