๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.63K 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
def largestArea(samples):
    R = len(samples)
    C = len(samples[0])
    S = [[0] * C for _ in range(R)]
    M = [[0] * C for _ in range(R)]

    for d in range(R):
        for b in range(C):
            M[d][b] = samples[d][b]

    for i in range(R):
        S[i][0] = M[i][0]

    for j in range(C):
        S[0][j] = M[0][j]

    for i in range(1, R):
        for j in range(1, C):
            if M[i][j] == 1:
                S[i][j] = min(S[i][j-1], min(S[i-1][j], S[i-1][j-1])) + 1
            else:
                S[i][j] = 0

    max_of_s = S[0][0]
    max_i = 0
    max_j = 0
    for i in range(R):
        for j in range(C):
            if max_of_s < S[i][j]:
                max_of_s = S[i][j]
                max_i = i
                max_j = j

    return abs(max_i - max_of_s) - max_i

Product Defects โœ…
Company โ€“ DueToHQ
Role โ€“ Business Analytics Internship
Exp. โ€“ Fresher
Apply Here โ€“ https://internshala.com/internship/details/work-from-home-business-analytics-internship-at-duetohq1713164431?utm_source=cp_link&referral=web_share

Company โ€“ PapaSiddhi
Role โ€“ Machine Learning Development
Exp. โ€“ Fresher
Apply Here โ€“ https://internshala.com/internship/details/machine-learning-development-internship-in-udaipur-at-papasiddhi1713153810?utm_source=cp_link&referral=web_share

Company โ€“ Ozibook Tech Solutions Private Limited
Role โ€“ Data Analytics Internship
Exp. โ€“ Fresher
Apply Here โ€“ https://internshala.com/internship/details/work-from-home-part-time-data-analytics-internship-at-ozibook-tech-solutions-private-limited1713066596?utm_source=cp_link&referral=web_share
ll solve(vector<ll>& a) {
    unordered_map<ll, ll> c;
    ll l = 0, r = 0;
    ll m = 0;
    while (r < a.size()) {
        c[a[r]]++;
        while (c.size() > 2) {
            if (--c[a[l]] == 0) {
                c.erase(a[l]);
            }
            l++;
        }
        m = max(m, r - l + 1);
        r++;
    }
    return m;
}

Longest Subarray โœ…
๐Ÿ‘2
Maruti Suzuki All India Hiring Test:

Role: Assistant Manager

Graduation Year: 2022

Degree: B.Tech / M.Tech

Eligible Branches: Mechanical, Automobile, Civil, Electrical, Electronics, Mechatronics and Tool & Die

Age: 21 to 27 years

Work Experience: 12 to 22 months

Selection Process:
1. Profile Shortlisting
2. Online Test (Technical, Aptitude & Psychometric)
3. Personal Interview (Technical + HR)
4. Offer
5. Medical Test
6. Joining

B.Tech CTC: 10.34 LPA (8.3 LPA - Fixed)
M.Tech CTC: 10.99 LPA (8.85 LPA Fixed)

Location: PAN - India

Apply Link: https://maruti.app.param.ai/jobs/all-india-hiring-ait-2024-btech-and-mtech


Last Date to Apply: 21st April 2024
๐Ÿ‘2
private static double[] calculateMovingAverage(int[] array, int K) {
        double[] smoothedArray = new double[array.length - K + 1];
        double sum = 0;

      
        for (int i = 0; i < K; i++) {
            sum += array[i];
        }

      
        for (int i = 0; i <= array.length - K; i++) {
            if (i > 0) {
              
                sum = sum - array[i - 1] + array[i + K - 1];
            }
            smoothedArray[i] = sum / K;
        }

        return smoothedArray;
    }

Moving Averagesโœ…
๐ŸŽ‰1
#include <iostream>
#include <vector>

using namespace std;

int divideTerritory(int n, vector<int>& qualities) {
    int totalQuality = 0;
    for (int i = 0; i < n; ++i) {
        totalQuality += qualities[i];
    }
    if (totalQuality % 3 != 0) {
        return 0;
    }
   
    int targetQuality = totalQuality / 3;
    vector<int> prefixSums(n, 0);
    int currentSum = 0;
    int count = 0;
   
    for (int i = 0; i < n; ++i) {
        currentSum += qualities[i];
        prefixSums[i] = currentSum;
    }
   
    for (int i = 0; i < n - 2; ++i) {
        if (prefixSums[i] == targetQuality) {
            for (int j = i + 1; j < n - 1; ++j) {
                if (prefixSums[j] - prefixSums[i] == targetQuality && prefixSums.back() - prefixSums[j] == targetQuality) {
                    count++;
                }
            }
        }
    }
   
    return count;
}

Three little pigs โœ…
#include <iostream>
#include <string>
#include <stack>
using namespace std;

int solve(const string& s) {
    stack<char> stk;
    int insertions = 0;
   
    for (char c : s) {
        if (c == '(') {
            stk.push(c);
        } else {
            if (stk.empty()) {
                insertions++;
            } else {
                stk.pop();
            }
        }
    }
   
    insertions += stk.size();
    return insertions;
}

The String โœ…
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
#include <iostream> #include <vector> using namespace std; int divideTerritory(int n, vector<int>& qualities) {     int totalQuality = 0;     for (int i = 0; i < n; ++i) {         totalQuality += qualities[i];     }     if (totalQuality % 3 != 0) {        โ€ฆ
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll dp[110][110];
ll currsumdp[110][110];
ll sum=0;
ll helper(ll i,ll n,ll part,ll curr,ll totsum,vector<ll>&a)
{
    if(i!=n and part==4) return 0;
    if(i==n) return(part==4)?1:0;
    if(currsumdp[i][part]) return dp[i][part];
    curr+=a[i];
    currsumdp[i][part]=1;
   return dp[i][part]=helper(i+1,n,part,curr,totsum,a)+((curr==(totsum/3)*part)?helper(i+1,n,part+1,curr,totsum,a):0);

}
ll solve(vector<ll>&a)
{
    ll n=a.size();
    for(auto it:a) sum+=it;
    if(n<3 or sum%3) return 0;
    memset(dp,-1,sizeof(dp));
    return helper(0,n,1,0,sum,a);
}
signed main() {
    ll n; cin>>n;
    vector<ll>a(n);
    for(ll i=0;i<n;i++) cin>>a[i];
    cout<<solve(a);
    return 0;
}


Three little pigs โœ…
๐Ÿ‘Ž3๐Ÿ‘2
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll solve(vector<char>&a)
{
    stack<char>st;
    ll n=a.size();
    ll i=0;
    while(i<n)
    {
        if(a[i]=='P')
        {
            i++;
            st.push(a[i]);
        }
        else if(a[i]=='B')
        {
            i++;
            if(st.top()==a[i]) st.pop();
            else break;
        }
        i++;
    }
    if(st.empty()) return -1;
    return st.size()+1;
}
signed main() {
    
     string s;
     getline(cin,s);
     vector<char>a;
     for(auto it:s)
        if(it!=' ') a.push_back(it);
     cout<<solve(a);

    return 0;
}

Flipkart โœ…
int countSetBits(int num) {
    return __builtin_popcount(num);
}

int main() {
    int T;
    cin >> T;
    while (T--) {
        int N, K;
        cin >> N >> K;
        vector<int> array(N);
        for (int i = 0; i < N; i++) {
            cin >> array[i];
        }
       
        int validSubsetCount = 0;
        int maxSubsetMask = (1 << N) - 1;
        for (int mask = 0; mask <= maxSubsetMask; mask++) {
            int subsetSum = 0;
            for (int j = 0; j < N; j++) {
                if (mask & (1 << j)) {
                    subsetSum += array[j];
                }
            }
            if (countSetBits(subsetSum) == K) {
                validSubsetCount++;
            }
        }
       
        cout << validSubsetCount << endl;
    }
    return 0;
}

Flipkart โœ…
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int maxBagsFilled(int weight, int s1, int s2, int s3) {
    vector<int> dp(weight + 1, -1e9);
    dp[0] = 0;

    vector<int> sizes = {s1, s2, s3};

    for (int i = 1; i <= weight; i++) {
        for (int size : sizes) {
            if (i >= size && dp[i - size] != -1e9) {
                dp[i] = max(dp[i], dp[i - size] + 1);
            }
        }
    }

    return dp[weight] > 0 ? dp[weight] : 0;
}

int main() {
    int weight;
    int s1, s2, s3;
   
    cin >> weight;
    cin >> s1 >> s2 >> s3;
   
    cout << maxBagsFilled(weight, s1, s2, s3) << endl;
   
    return 0;
}

Flipkart โœ