๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.63K subscribers
5.61K photos
3 videos
95 files
10.6K 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
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll solve(ll n)
{
    vector<ll>bin(32);
    ll i=0;
    while(n)
    {
        bin[i]=n%2;
        n=n/2;
        i++;
    }
    string s;
    for(ll j=i-1;j>=0;j--) s.push_back((char)(bin[j]+'0'));
    //cout<<s<<endl;
    n=s.length();
    ll ans=0,f=1;
    for(ll i=0;i<n;i++)
    {
        ll dig=s[i]-'0';
        ll p=dig>0?pow(2,n-(i+1)):0;
        ll st=dig*(2*p-1);
        ans+=st*f;
        if(dig==0) f=1;
        else f=-1;
    }
    return ans;
}
signed main()
{
    ll n; cin>>n;
    cout<<solve(n);
}

Binary Manipulation โœ…
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
public static int getMinCost(int[] heights, int[] cost) {
        int n = heights.length;
        int[][] dp = new int[n][3];

        for (int i = 0; i < n; i++) {
            if (i == 0) {
                dp[i][0] = 0;
                dp[i][1] = cost[i];
                dp[i][2] = 2 * cost[i];
            } else {
                dp[i][0] = Math.min((heights[i - 1] != heights[i] ? dp[i - 1][0] : Integer.MAX_VALUE),
                                    Math.min((heights[i - 1] + 1 != heights[i] ? dp[i - 1][1] : Integer.MAX_VALUE),
                                             (heights[i - 1] + 2 != heights[i] ? dp[i - 1][2] : Integer.MAX_VALUE)));
               
                dp[i][1] = Math.min((heights[i - 1] != heights[i] + 1 ? dp[i - 1][0] : Integer.MAX_VALUE),
                                    Math.min((heights[i - 1] + 1 != heights[i] + 1 ? dp[i - 1][1] : Integer.MAX_VALUE),
                                             (heights[i - 1] + 2 != heights[i] + 1 ? dp[i - 1][2] : Integer.MAX_VALUE))) + cost[i];
               
                dp[i][2] = Math.min((heights[i - 1] != heights[i] + 2 ? dp[i - 1][0] : Integer.MAX_VALUE),
                                    Math.min((heights[i - 1] + 1 != heights[i] + 2 ? dp[i - 1][1] : Integer.MAX_VALUE),
                                             (heights[i - 1] + 2 != heights[i] + 2 ? dp[i - 1][2] : Integer.MAX_VALUE))) + 2 * cost[i];
            }
        }

        return Math.min(dp[n - 1][0], Math.min(dp[n - 1][1], dp[n - 1][2]));
    }

Unequal Block Structureโœ…
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include <bits/stdc++.h>
using namespace std;
vector<string> solve(vector<string>& chain, vector<string>& elements) {
    unordered_map<string, int> required, window;
    for (const auto& elem : elements) {
        required[elem]++;
    }
    int requiredSize = required.size();
    int have = 0;
    int left = 0, right = 0;
    int minLength = INT_MAX;
    int start = -1;
    while (right < chain.size()) {
        string rightElem = chain[right];
        if (required.count(rightElem)) {
            window[rightElem]++;
            if (window[rightElem] == required[rightElem]) {
                have++;
            }
        }
        while (have == requiredSize) {
            if (right - left + 1 < minLength) {
                minLength = right - left + 1;
                start = left;
            }
            string leftElem = chain[left];
            if (required.count(leftElem)) {
                window[leftElem]--;
                if (window[leftElem] < required[leftElem]) {
                    have--;
                }
            }
            left++;
        }
        right++;
    }
    if (start == -1) {
        return {};
    }
    return vector<string>(chain.begin() + start, chain.begin() + start + minLength);
}
Gadgeon Systems Inc. Hiring Fresher Firmware Engineer Intern ๐Ÿš€

Job Designation : Firmware Intern

Requirements and Skills
โ€ข  Degree - B.Tech/ M.Tech
โ€ข  Solid programming experience in C or C++
โ€ข  Team Player, can work well with maintaining track of projects

Interested candidates please apply on nithya.km@gadgeon.com
Internship Opportunity!

BDO India is hiring interns for its Actuarial Team.
Candidates should be graduates and must have cleared at least 3 CT Papers, including CM1.
Preferred skills include knowledge of Excel, R, and Python.
Location: Mumbai/Gurugram with a hybrid working model.

If you know someone who would be a great fit, please recommend them or reach out to Shilpy Kalia at shilpykalia@bdo.in with the subject line "BDO India - Actuarial Intern."