๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.52K subscribers
5.56K photos
3 videos
95 files
9.72K 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 <vector>
#include <cmath>
#include <algorithm>
using namespace std;

long maximize(int x_rows, int x_columns, vector<vector<int>>& x) {
    vector<vector<long>> prefixSum(x_rows + 1, vector<long>(x_columns + 1, 0));
    for (int i = 1; i <= x_rows; ++i) {
        for (int j = 1; j <= x_columns; ++j) {
            prefixSum[i][j] = x[i-1][j-1] +
                               prefixSum[i-1][j] +
                               prefixSum[i][j-1] -
                               prefixSum[i-1][j-1];
        }
    }

    long maxF = 0;

    for (int h = 1; h < x_rows; ++h) {
        for (int v = 1; v < x_columns; ++v) {
            long sumA = prefixSum[h][v];
            long sumB = prefixSum[h][x_columns] - prefixSum[h][v];
            long sumC = prefixSum[x_rows][v] - prefixSum[h][v];
            long sumD = prefixSum[x_rows][x_columns] - prefixSum[h][x_columns] - prefixSum[x_rows][v] + prefixSum[h][v]; // Bottom-right
            long fX = abs(sumA) + abs(sumB) + abs(sumC) + abs(sumD);
            maxF = max(maxF, fX);
        }
    }

    return maxF;
}
Blinkit Analyst Intern

Looking for a talented individual to join as an Analyst Intern in the Central Ops strategy team at Blinkit in Gurgaon.

Key Skills:

- Proficiency in Basic SQL and Excel (including Dashboarding and VBA).

Strong problem-solving abilities and logical thinking.

- Final-year students or fresh graduates preferred, but open to others.

Additional information:

- Internship Duration: 3 months

- PPO based on performance

Join us ASAP (preferably within 7-15 days) by filling out the form below. Applications

open till 27th Oct'24.


https://docs.google.com/forms/d/e/1FAIpQLSe604ZBbM5HqQmuPo7vHT4guszf0TNsakzILpE3ZMHhOH6iTQ/viewform
def ss(firstnum: str, secondnum: str, thirdnum: str) -> bool:
    target_sum = int(thirdnum)
    second_value = int(secondnum)
    if int(firstnum) + second_value == target_sum:
        return True
    for i in range(len(firstnum)):
        new_firstnum = firstnum[:i] + firstnum[i+1:]
        if new_firstnum and (new_firstnum[0] != '0'):
            if int(new_firstnum) + second_value == target_sum:
                return True
    return False
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include <bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int T;
    cin >> T;
    for(int test_case=1; test_case<=T; test_case++){
        int N;
        cin >> N;
        string S = "";
        cin>>S;
   
        vector<int> pre(2*N +1, 0);
        for(int i=1; i<=2*N; i++){
            if(S[i-1] == 'R'){
                pre[i] = pre[i-1] +1;
            }
            else{
                pre[i] = pre[i-1] -1;
            }
        }

        unordered_map<int, int> dp1,dp2;
        for(int i=0; i<=2*N; i++){
            int d = pre[i];
            if(i <= N){
                if(dp1.find(d) == dp1.end()){
                    dp1[d] = i;
                }
            }
            if(i >= N){
                if(dp2.find(d) == dp2.end() || i > dp2[d]){
                    dp2[d] = i;
                }
            }
        }

        int mx =0;
        for(auto &entry : dp1){
            int d = entry.first;
            if(dp2.find(d) != dp2.end()){
                int last = dp2[d] - entry.second;
                if(last > mx){
                    mx = last;
                }
            }
        }
        int ans = 2 * N - mx;
        cout << "#" << test_case << " " << ans << "\n";
    }
}

Samsung (R&D)โœ…
#include<iostream>
using namespace std;
int solve(vector<int>ribbons, int k)
{
    int low=0, high=*max_element(ribbons.begin(), ribbons.end());
    while(low<high)
    {      
        int mid=(low+high+1)>>1;
        int cnt=0;
        for(int r:ribbons)
            cnt+=r/mid;
           
        if(cnt<k)
            high=mid-1;
        else
            low=mid;
    }
    return low;
}
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] arr = new int[N];
        for(int i=0;i<N;i++) arr[i] = sc.nextInt();
        int k = sc.nextInt();
        Arrays.sort(arr);
        int left=0, right=N-1, moves=0;
        while(left <= right){
            if(arr[left] + arr[right] <=k) left++;
            right--;
            moves++;
        }
        System.out.println(moves);
    }
}


Zeta โœ…
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
import java.util.*;
import java.io.*;

public class Main {
    static class Segment {
        int L;
        int R;
        int cost;
        Segment(int L, int R, int cost){
            this.L = L;
            this.R = R;
            this.cost = cost;
        }
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        sc.nextInt(); // Read the '3' and ignore
        Segment[] segments = new Segment[N];
        for(int i=0;i<N;i++) {
            int L = sc.nextInt();
            int R = sc.nextInt();
            int cost = sc.nextInt();
            segments[i] = new Segment(L, R, cost);
        }
        Segment[] sortedByL = segments.clone();
        Arrays.sort(sortedByL, new Comparator<Segment>() {
            public int compare(Segment a, Segment b){
                if(a.L != b.L) return Integer.compare(a.L, b.L);
                return Integer.compare(a.R, b.R);
            }
        });
        Segment[] sortedByR = segments.clone();
        Arrays.sort(sortedByR, new Comparator<Segment>() {
            public int compare(Segment a, Segment b){
                if(a.R != b.R) return Integer.compare(a.R, b.R);
                return Integer.compare(a.L, b.L);
            }
        });
        long minCost = Long.MAX_VALUE;
        long minProduct = Long.MAX_VALUE;
        int r_ptr = 0;
        for(int i=0;i<N;i++) {
            Segment current = sortedByL[i];
            while(r_ptr < N && sortedByR[r_ptr].R < current.L){
                if(sortedByR[r_ptr].cost < minCost){
                    minCost = sortedByR[r_ptr].cost;
                }
                r_ptr++;
            }
            if(minCost != Long.MAX_VALUE){
                long product = minCost * (long)current.cost;
                if(product < minProduct){
                    minProduct = product;
                }
            }
        }
        if(minProduct != Long.MAX_VALUE){
            System.out.println(minProduct);
        }
        else{
            System.out.println(-1);
        }
    }
}


Zeta โœ…
int best=0;
int dfs(TreeNode* root) {
   if(root==NULL)return -1;
   int left = dfs(root->left);
   int right = dfs(root->right);
   int res = root->val;
   if(left*right>=0 && left+right>=0) res+=left+right;
   best = max(best,res);
   return res;
}
int maxPerfectSubtree(TreeNode* root) {
   solve(root);
   return best;
}


American Express โœ…
def solution(S):
    r={'AB','BA','CD','DC'}
    s=[]
    for c in S:
        if s and s[-1]+c in r:
            s.pop()
        else:
            s.append(c)
    return ''.join(s)


American Express โœ