๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
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
One advice to all the freshers out there!! For a single job openings 1000s of candidates are applying and getting your resume shortlisted for further process are quite tough.

Instead, check with your friends and collegemate, when they get placed they will received an offer letter from HR, ask them to share the HR mail id and try to reach out directly.

In this way chances of getting replied back will be more.
๐Ÿ‘6
#include <bits/stdc++.h>
  using namespace std;

  int main() {
    int mod = 1000000007;
    string s;
    cin>>s;
    long long n = s.size();
    long long i=0;
    long long ans = 1;
    for(i=0;i<n;i++){
      long long c = 1;
      while(i<n-1 && s[i]==s[i+1]){
        c++;
        i++;
      }
      ans = (ans*c)%mod;
     
    }
    cout<<ans%mod;
    return 0;

  }

Alex Keyboard โœ…
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    int N;
    cin >> N;
    vector<int> candies(N);
    for (int i = 0; i < N; ++i) {
        cin >> candies[i];
    }
    int min_value = candies[0];
    int max_tastiness_index = -1;
    for (int i = 1; i < N; ++i) {
        int current_difference = candies[i] - min_value;
        if (current_difference > max_tastiness_index) {
            max_tastiness_index = current_difference;
        }
        if (candies[i] < min_value) {
            min_value = candies[i];
        }
    }
    cout << max_tastiness_index << endl;
    return 0;
}

Tastiness index โœ…
๐Ÿ‘2
#include<bits/stdc++.h>
using namespace std;

int maxi = 0;

int F(int col , vector<vector<int>> &a , vector<int> &dp){
    if(col == a[0].size()){
        return maxi = max(maxi , (int) dp.size());
    }
    for(int row = 0 ; row < a.size() ; row++){
        if(dp.size() == 0 || dp.back() < a[row][col]){
            dp.push_back(a[row][col]);
            F(col + 1 , a , dp);
            dp.pop_back();
        }
        else{
            int id = lower_bound(dp.begin() , dp.end() , a[row][col]) - dp.begin();
            int old = dp[id];
            dp[id] = a[row][col];
            F(col + 1 , a , dp);
            dp[id] = old;
        }
    }
}

int longestSequence(vector<vector<int>> &matrix){
    maxi = 0;
    vector<int> dp;
    F(0 , matrix , dp);
    return maxi;
}

DE Shaw โœ…
#include <iostream>
#include <unordered_set>
#include <string>
using namespace std;
void generateSubstrings(const string &s, int len, unordered_set<string> &substrings) {
    for (int i = 0; i <= s.size() - len; ++i) {
        substrings.insert(s.substr(i, len));
    }
}

string findMinimalString(const string &s) {
    unordered_set<string> substrings;
    for (int len = 1; ; ++len) {
        substrings.clear();
        generateSubstrings(s, len, substrings);
        string candidate(len, 'a');
        while (true) {
            if (substrings.find(candidate) == substrings.end()) {
                return candidate;
            }
            int pos = len - 1;
            while (pos >= 0 && candidate[pos] == 'z') {
                candidate[pos] = 'a';
                --pos;
            }
            if (pos < 0) break;
            ++candidate[pos];
        }
    }
}

int main() {
    string S;
    cin >> S;
    cout << findMinimalString(S) << endl;
    return 0;
}. 

// Minimal String

Infosys โœ…
๐Ÿ‘1
#include <iostream>
#include <vector>
using namespace std;
vector<bool> sieve(int max_val) {
    vector<bool> is_prime(max_val + 1, true);
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i * i <= max_val; ++i) {
        if (is_prime[i]) {
            for (int j = i * i; j <= max_val; j += i) {
                is_prime[j] = false;
            }
        }
    }
    return is_prime;
}

int main() {
    int N;
    cin >> N;

    vector<int> A(N);
    int max_val = 0;
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
        if (A[i] > max_val) {
            max_val = A[i];
        }
    }

    vector<bool> is_prime = sieve(max_val);

    int prime_count = 0, composite_count = 0;
    for (int i = 0; i < N; ++i) {
        if (is_prime[A[i]]) {
            prime_count++;
        } else {
            composite_count++;
        }
    }

    int good_pairs = prime_count * composite_count;
    cout << good_pairs << endl;

    return 0;
}.  

find good pairs in array
Infosys โœ