๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.59K subscribers
5.59K photos
3 videos
95 files
10.1K 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
Malay Sharma, Co-founder of Peoplegains is offering a group session to help you discover your skills & techniques and to answer your questions and doubts directly.

Heโ€™ll be sharing the following:

- Experience and insights on the interview process
- How to enhance your skill set
- Tips to grab high-paying job opportunities
- Ways to build your resume.

Register now - https://visit.preplaced.in/g18

The session will also include a live Q&A, where the mentor will answer all your doubts and concerns.
๐Ÿ‘1
float calculate_total_amount(int count_50, int count_1, int count_2, int count_5){
    float a = count_50 * 0.50;  
    float b = count_1 * 1.00;    
    float c = count_2 * 2.00;  
    float d = count_5 * 5.00;  

    float res = a + b + c + d;

    return res;
}
bool isDancingNumber(int num) {
    string str_num = to_string(num);

    for (int i = 1; i < str_num.length(); i++) {
        int diff = abs(str_num[i] - str_num[i - 1]);
        if (diff != 1 && diff != 9) {
            return false;
        }
    }

    return true;
}

vector<int> print_dancing_numbers(int dancing_limit) {
    vector<int> dancingNumbers;

    for (int i = 0; i <= dancing_limit; i++) {
        if (isDancingNumber(i)) {
            dancingNumbers.push_back(i);
        }
    }

    return dancingNumbers;
}
๐Ÿ‘1
string convert(string s, int numRows) {
        int n = 0;
        int i = 0;
        bool direction = true;
        map<int,vector<char>> ds;
        for(auto e:s)
        {
            ds[n].push_back(s[i]);
            if(n == numRows-1)
            {
                direction = false;
            }
            if(n == 0)
            {
                direction = true;
            }
            i++;
            if(direction)
            {
                n++;
            }
            else
            {
                n--;
            }
        }
        string ans = "";
        for(auto e:ds)
        {
            reverse(e.second.begin(),e.second.end());
            for(auto k:e.second)
            {
                ans.push_back(k);
            }
        }
        reverse(ans.begin(),ans.end());
        return ans;
    }
#include<bits/stdc++.h>
using namespace std;
const int MAX_CHAR = 100;

bool check(int freq[], int k) {
    for (int i = 0; i < MAX_CHAR; i++) {
        if (freq[i] != 0 && freq[i] != k) {
            return false;
        }
    }
    return true;
}

int perfectSubstring(string s, int k) {
    int count = 0;
    for (int i = 0; s[i]; i++) {
        int freq[MAX_CHAR] = {0}; // Initialize the frequency array for each character
        for (int j = i; s[j]; j++) {
            int index = s[j] - '0';
            freq[index]++;

            if (freq[index] > k) {
                break;
            }
            else if (freq[index] == k && check(freq, k)) {
                count++;
            }
        }
    }
    return count;
}

int main() {
    string s;
    int k;
    
    cout << "";
    cin >> s;
    
    cout <<"";
    cin >> k;
    
    int result = perfectSubstring(s, k);
    cout << " " << result << endl;
    return 0;
}

UI Path โœ…
๐Ÿ‘2โค1
unordered_map<string, int> memo;

int recur_cost(const vector<int>& lst, int x, int y, int pos, int curr_cost, int count) {
    int minm_cost = INT_MAX;
    string key = to_string(pos) + "|" + to_string(count);

    if (memo.find(key) != memo.end()) {
        return memo[key];
    }

    if (pos >= lst.size() && count == 0) {
        return curr_cost;
    }

    if (pos >= lst.size()) {
        return minm_cost;
    }

    if (count == 0) {
        return curr_cost;
    }

    int curr = recur_cost(lst, x, y, pos + y, lst[pos] + curr_cost, count - 1);
    int skip_curr = recur_cost(lst, x, y, pos + 1, 0, x);
    minm_cost = min(minm_cost, min(curr, skip_curr));
    memo[key] = minm_cost;
    return minm_cost;
}

int minm_rehab_cost_r(const vector<int>& lst, int x, int y) {
    memo.clear();
    return recur_cost(lst, x, y, 0, 0, x);
}

Microsoft Task 1โœ…
โค1