๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.62K subscribers
5.59K photos
3 videos
95 files
10.2K 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
CelebAI Technologies are hiring for Associate Software Engineer Position(Trainee+ FTE).

Walk in drive in the office for 2023, 2024 batch.
Please share your CV at
careers@celeb-ai.com.

Eligibility: Only Delhi NCR students or who can come to Delhi and haven't attended drive from last 6 months should apply.
[Please increase the reach for visibility]
๐Ÿ‘1
#include<stdio.h>
#include<stdlib.h>

#define MOD 1000000007

int compare(const void *a, const void *b) {
    return (*(int*)a - *(int*)b);
}

int main() {
    int N;
    scanf("%d", &N);

    if (N <= 1) {
        printf("NO HOURS\n");
        return 0;
    }

    int *A = (int*)malloc(N * sizeof(int));

    for (int i = 0; i < N; i++) {
        scanf("%d", &A[i]);
    }

    qsort(A, N, sizeof(int), compare);

    int count = 0;

    for (int i = 0; i < N - 1; i++) {
        for (int j = i + 1; j < N; j++) {
            if ((A[i] + A[j]) % 60 == 0) {
                count = (count + 1) % MOD;
            }
        }
    }

    if (count > 0) {
        printf("%d\n", count);
    } else {
        printf("NO HOURS\n");
    }

    free(A);

    return 0;
}

Hours Count โœ…
NPCI
๐Ÿ‘1
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }

        ArrayList<Integer> arr = new ArrayList<>();
        int c = 1;

        for (int i = 0; i < n - 1; i++) {
            if (a[i] != a[i + 1]) {
                arr.add(c);
                c = 1;
            } else {
                c++;
            }
        }

        arr.add(c);

        int ans = 0;

        if (arr.size() == 2) {
            ans = Math.min(arr.get(0), arr.get(1)) * 2;
        } else if (arr.size() > 2) {
            ans = Collections.max(arr.subList(1, arr.size() - 1)) * 2;
        }

        System.out.println(ans);
    }
}

Longest Mirror subArray
NPCIโœ…
#include<bits/stdc++.h>
using namespace std;

vector<int> solve(int Q, vector<vector<int>> queries) {
    vector<int> ans, a(10005, 0);

    for (vector<int>& query : queries) {
        int type = query[0], element = query[1];

        if (type == 0) {
            a[element] = 1;
        } else {
            if (a[element]) {
                ans.push_back(1);
                a[element] = 0;
            } else {
                ans.push_back(0);
            }
        }
    }

    return ans;
}

BST Queries โœ…
๐Ÿ“ฃ Job Title: Salesforce Developer (Freshers)

๐ŸŒŸ๐ŸŒŸ๐ŸŒŸ๐ŸŒŸ๐ŸŒŸ๐ŸŒŸ๐ŸŒŸ๐ŸŒŸ๐ŸŒŸ๐ŸŒŸ๐ŸŒŸ๐ŸŒŸ๐ŸŒŸ๐ŸŒŸ๐ŸŒŸ

๐Ÿข Company: VITTECH PVT LTD

๐Ÿ“Location: Pune

๐Ÿ‘‰ Exp: 0- 1 Years

๐Ÿ“ฉ Mail: megha@vittech.in
vector<vector<int>> dp;
int recur(vector<int>& h,int pos,int r_x, int r_y,int n)
{  
    if(pos>=n) return 0;
    if(dp[pos][abs(r_x-r_y)]!=-1) return dp[pos][abs(r_x-r_y)];
    int v1=0,v2=0,v3=0;
    if(r_x>=h[pos]){
        v1=1+recur(h,pos+1,r_x-h[pos],r_y,n);
    }
    if(r_y>=h[pos]){
        v2=1+recur(h,pos+1,r_x,r_y-h[pos],n);
    }
    v3=recur(h,pos+1,r_x,r_y,n);
    return dp[pos][abs(r_x-r_y)]=max(v1,max(v2,v3));
}

int solution(vector<int>&h,int n,int x,int y)
{
    dp.resize(n,vector<int>(max(x,y)+1,-1));
    return recur(h,0,x,y,n);
}

Microsoft โœ…
bool help(int n,unordered_set<char>&mpp)
{
    string s=to_string(n);
    for(auto it:s)
    {
        if(mpp.count(it)) return 1;
    }
    return 0;
}
int solve(vector<int>&a,int n)
{
    sort(a.begin(),a.end());
    int maxi=a[n-1];
    string s=to_string(maxi);
    unordered_set<char>mpp;
    for(auto it:s) mpp.insert(it);

    int ans=-1;
    for(int i=0;i<n-1;i++)
    {
        if(help(a[i],mpp)==0) ans=a[i];
    }
    if(ans==-1) return -1;
    return ans+maxi;
}

Microsoft โœ