๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
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
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
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."
#include <bits/stdc++.h>
using namespace std;
void f(int i,int m,int down, int power,int& ans){
    if (i > m+2) return;
    if (i < 0) return;
    if(i == m) ans++;
    f(i+pow(2,power),m,1,power+1,ans);
    if (down)
    {
        f(i-1,m,0,power,ans);
    }
}

int solve(int m){
    int ans = 0;
    f(1,m,1,0,ans);
    return ans;
}


Game of stairs โœ…
#include <bits/stdc++.h>
#define ll long long 
using namespace std;    
signed main()
{
     ll sz,n; cin>>sz>>n;
     vector<ll>a(n);
     for(ll i=0;i<n;i++) cin>>a[i];
     vector<vector<ll>>ans;
     for(ll i=0;i<sz-1;i++) a.insert(a.begin(),0);
     reverse(a.begin(),a.end());
     for(ll i=0;i<n;i++)
     { 
        vector<ll>curr;
        for(ll j=i;j<i+sz;j++) curr.push_back(a[j]);
        ans.push_back(curr);
     }
      reverse(ans.begin(),ans.end());
      for(ll i=0;i<ans.size();i++)
      {
        for(ll j=0;j<ans[i].size();j++) cout<<ans[i][j]<<" ";
        cout<<endl;
      }
    return 0;
}
๐Ÿ‘1