๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.6K 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
We looking for guys he have experience 5 years working in kuwait
Role: Python Developer (Fresher)
Location: kuwait
Note: - Immediate
Python Development
Machine Learning
Natural Language Processing
Generative AI
Data Analysis
Salary and commission from our project
contact +965 9979 7898 (WhatsApp)
๐Ÿคฎ2
We are seeking 1-2 research interns to work on image and video synthesis at NVIDIA, with a special focus on generative image and video enhancement. Internships are expected to begin either in late January or summer 2025. Potential areas of research include, but are not limited to: 1. Generative image/video enhancement with perceptual guidance 2. Foundational image/video enhancement models emphasizing controllability, creativity, and identity preservation 3. Efficient image/video generation while maintaining diversity and texture details 4. More related topics in visual synthesis.
We are particularly interested in PhD candidates with strong publication records in visual synthesis. If you are interested, please send your resume to wxiongur@gmail.com
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <climits>
using namespace std;
int ss(const string& substring, int sameTime) {
    vector<int> freq(26, 0);
    for (char ch : substring) freq[ch - 'a']++;
   
    int count = 0;
    for (int f : freq) {
        if (f > 1) count += (f * (f - 1)) / 2;
    }
   
    return count * sameTime;
}

int getMinimumTime(string s, int sameTime, int partitionTime) {
    int n = s.size();
    vector<int> dp(n + 1, INT_MAX);
    dp[0] = 0;
   
    for (int i = 1; i <= n; ++i) {
        for (int j = 0; j < i; ++j) {
            string substring = s.substr(j, i - j);
            int extraTime = ss(substring, sameTime);
            dp[i] = min(dp[i], dp[j] + extraTime + (j > 0 ? partitionTime : 0));
        }
    }
   
    return dp[n];
}


New Network Protocol โœ…
๐Ÿ‘1
def getScoreDifference(numSeq):
    first_score = 0
    second_score = 0
    for i, num in enumerate(numSeq):
        if i % 2 == 0:
            first_score += num
        else:
            second_score += num
        if num % 2 == 0:
            numSeq[i+1:] = numSeq[i+1:][::-1]
    return first_score - second_score

Match outcomes โœ…
๐Ÿคฎ5
#include <iostream>
#include <vector>

using namespace std;

int main() {
    string S;
    cin >> S;
    int n = S.length();
    vector<vector<int>> pref(n, vector<int>(26, 0));
    // Prefix count array to store count of each character in all prefixes
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 26; j++) {
            pref[i][j] = (i == 0 ? 0 : pref[i - 1][j]);
        }
        pref[i][S[i] - 'a']++;
    }
    int q;
    cin >> q;
    while (q--) {
        int x;
        char c;
        cin >> x >> c;
        x--; // Decrement x to change it to 0-based indexing
        long long ans = 0;
        for (int i = 0; i < n - x; i++) {
            ans += pref[i + x][c - 'a'] - (i == 0 ? 0 : pref[i - 1][c - 'a']);
        }
        cout << ans << endl;
    }
    return 0;
}

Substring queries โœ…
โค1๐Ÿ‘1
class Solution {
public:
    int minOperations(vector<int>& nums, int x, int y) {
        int l = 0, r = *max_element(nums.begin(), nums.end());
        auto check = [&](int t) {
            long long cnt = 0;
            for (int v : nums) {
                if (v > 1LL * t * y) {
                    cnt += (v - 1LL * t * y + x - y - 1) / (x - y);
                }
            }
            return cnt <= t;
        };
        while (l < r) {
            int mid = (l + r) >> 1;
            if (check(mid)) {
                r = mid;
            } else {
                l = mid + 1;
            }
        }
        return l;
    }
};


Job execution โœ…
๐Ÿคฉ1
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
using namespace std;
class UnionFind {
public:
    UnionFind(int size) {
        parent.resize(size);
        for (int i = 0; i < size; ++i) {
            parent[i] = i;
        }
    }

    int find(int u) {
        if (parent[u] != u) {
            parent[u] = find(parent[u]);
        }
        return parent[u];
    }

    void unionSets(int u, int v) {
        parent[find(u)] = find(v);
    }

private:
    vector<int> parent;
};

bool can_transform(int n, int d, const string& mantra, const string& curse) {
    if (mantra.length() != curse.length()) {
        return false;
    }

    UnionFind uf(n);

    for (int i = 0; i < n; ++i) {
        if (i + d < n) {
            uf.unionSets(i, i + d);
        }
        if (i + d + 1 < n) {
            uf.unionSets(i, i + d + 1);
        }
    }

    unordered_map<int, unordered_map<char, int>> mantraGroups;
    unordered_map<int, unordered_map<char, int>> curseGroups;

    for (int i = 0; i < n; ++i) {
        int root = uf.find(i);
        mantraGroups[root][mantra[i]]++;
        curseGroups[root][curse[i]]++;
    }

    for (const auto& entry : mantraGroups) {
        int root = entry.first;
        if (mantraGroups[root] != curseGroups[root]) {
            return false;
        }
    }

    return true;
}

int main() {
    int n, d;
    string mantra, curse;
    cin >> n >> d >> mantra >> curse;

    if (can_transform(n, d, mantra, curse)) {
        cout << "yes" << endl;
    } else {
        cout << "no" << endl;
    }

    return 0;
}


Rubrik โœ…
Vishwamitra and Raktbij
๐Ÿ‘3๐Ÿคฎ1
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include <iostream>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
using namespace std;

class Solution {
public:
    vector<vector<int>> constructGridLayout(int n, vector<vector<int>>& edges) {
    vector<vector<int>> adj(n);
        for(int i = 0; i < edges.size(); i++){
            adj[edges[i][0]].push_back(edges[i][1]);
            adj[edges[i][1]].push_back(edges[i][0]);
        }
        vector<int> dig(n,0);
        for(int i = 0; i < n; i++){
            for(auto val : adj[i]) dig[val]++;
        }

        int root = 0;
        for(int i = 0; i < n; i ++){
            if(dig[root] > dig[i]) root = i;
        }
        // cout<<root;
        vector<int> vis(n,0);
        vis[root] = 1;

        vector<int> row1;
        int x = adj[root][0];
        if(adj[root].size() == 2){
            if(dig[x] > dig[adj[root][1]]) x = adj[root][1];
        }
        row1.push_back(root);
        row1.push_back(x);
        vis[x] = 1;
        while(dig[root] != dig[x]){
            int d = 5;
            int k = INT_MAX;
            for(auto val : adj[x]){
                if(vis[val] == 0){
                    if(dig[val] < d) {
                        k = val;
                        d = dig[val];
                    }
                }
            }
            if(k == INT_MAX) break;
            vis[k] = 1;
            row1.push_back(k);
            x = k;
        }

        // for(auto val : row1) cout<<val<<" ";
        // cout<<endl;
        // for(auto val : vis) cout<<val<<" ";

        int c = row1.size();
        int r = n / c;

        vector<vector<int>> ans(r, vector<int>(c,0));
        for(int i = 0; i < c; i++) ans[0][i] = row1[i];
       
        for(int i = 1; i < r; i++){
            for(int j = 0; j < c; j++){
                for(auto val : adj[ans[i-1][j]]){
                    if(vis[val] == 0){
                        vis[val] = 1;
                        ans[i][j] = val;
                        break;
                    }
                }
            }
        }


        return ans;
    }
};


Backup Network โœ…
๐Ÿคฎ1
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
const long long MOD = 1e9 + 7;
long long basicForm(long long A) {
    long long B = 1;
    for (long long i = 2; i * i <= A; i++) {
        if (A % i == 0) {
            B *= i;
            while (A % i == 0) {
                A /= i;
            }
        }
    }
    if (A > 1) {
        B *= A; 
    }
    return B;
}

long long countDivisors(long long n) {
    long long divisors = 1;
    for (long long i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            int count = 0;
            while (n % i == 0) {
                n /= i;
                count++;
            }
            divisors *= (count + 1);
        }
    }
    if (n > 1) {
        divisors *= 2; 
    }
    return divisors;
}

long long findD(long long A) {
    long long B = basicForm(A);
    long long C = 1;
    for (long long i = 1; i * i <= B; i++) {
        if (B % i == 0) {
            C = (C * i) % MOD;
            if (i != B / i) {
                C = (C * (B / i)) % MOD; 
            }
        }
    }

    long long D = countDivisors(C);
    return D;
}

int main() {
    long long A;
    cin >> A;
     cout << findD(A) << endl;
    return 0;
}


converting numbersโœ…
๐Ÿ‘4๐Ÿ‘Ž1
def solve(K, T):
    MOD = 3001
    a = 1
    b = 2 
    for i in range(T):
        next_a = (K * b + a * a) % MOD
        next_b = (K * a + b) % MOD
        a, b = next_a, next_b
    return (a, b)

Simple recursive sequenceโœ…
๐Ÿ‘1๐Ÿ‘Ž1๐Ÿ”ฅ1
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include <iostream>
#include <unordered_set>
#include <vector>
using namespace std;
vector<bool> solution(int n, vector<vector<int>>queens, vector<vector<int>>queries) {
    unordered_set<int> a, b, cs, d;
        for (const auto &queen : queens) {
        int r = queen[0], c = queen[1];
        a.insert(r);                
        b.insert(c);               
        cs.insert(r - c);      
        d.insert(r + c);       
    }
    vector<bool> r;
    for (const auto &query : queries) {
        int r_q = query[0], c_q = query[1];
        bool u = (a.count(r_q) > 0 || b.count(c_q) > 0 ||  cs.count(r_q - c_q) > 0 || d.count(r_q + c_q) > 0);
        r.push_back(u);
    }
    return r;
}
๐Ÿ‘3๐Ÿคฎ2
def p(packet):
    bitmask = 0
    for ch in packet:
        bitmask |= (1 << (ord(ch) - ord('a')))
    return bitmask

def ss(packets):
    n = len(packets)
    bitmasks = [p(p) for p in packets]
    lengths = [len(p) for p in packets]
    m = 0
    for i in range(n):
        for j in range(i + 1, n):
            if (bitmasks[i] & bitmasks[j]) == 0:
                m = max(m, lengths[i] * lengths[j])
    return m
num = int(input())
packets = [input() for _ in range(num)]
result = ss(packets)
print(result)


Wipro โœ…
๐Ÿ‘1๐Ÿคฉ1
def ss(cipherCode):
    digits = list(str(abs(cipherCode)))
    digits.sort()
    if digits[0] == '0': 
        for i in range(1, len(digits)):
            if digits[i] != '0':
                digits[0], digits[i] = digits[i], digits[0]
                break
    d = int(''.join(digits))
    if cipherCode < 0:
        d = -d
    print(d)
cipherCode = int(input())
ss(cipherCode)


Wipro โœ