๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
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
#include <bits/stdc++.h>
using namespace std;
using II = long long;
II solve(vector<int> nums) {
    vector<int> Primes;
    for(int num = 2; num <= 200; num++) {
        bool isPrime = true;
        for(int factor = 2; factor * factor <= num; factor++) {
            if(num % factor == 0) {
                isPrime = false;
                break;
            }
        }
        if(isPrime) Primes.push_back(num);
    }
    map<II, II> mp;
    II ans = 0, mask = 0, one = 1;
    mp[mask] = 1;
    for(int num : nums) {
        for(int pos = 0; pos < Primes.size(); pos++) {
            int power = 0;
            while(num % Primes[pos] == 0) {
                num /= Primes[pos];
                power++;
            }
            if(power & 1) mask ^= (one << pos);
        }
        ans += mp[mask]++;
    }
    return ans;
}


Optimal subarray configurations โœ…
Calling all 2023 and 2024 graduates!

Are you ready to make your mark in the world of ReactJS and React Native? Look no further!

Join us at the Appinventiv Mohali Office for an exclusive drive!

Drive Date: 26th July, Friday Time: 10:30 AM - 5:30 PM Venue: Appinventiv, Mohali

Office Don't miss out on this fantastic opportunity! Register now and take the first step towards an incredible career with Appinventiv - https://lnkd.in/gPWYsuxX
const int MOD = 1'000'000'007;

int countBalancedWords(int n, int d) {

    vector<vector<int>> dp(n + 1, vector<int>(26, 0));

    for (int j = 0; j < 26; ++j) {
        dp[1][j] = 1;
    }

    for (int i = 2; i <= n; ++i) {
        for (int j = 0; j < 26; ++j) {
            for (int k = 0; k < 26; ++k) {
                if (abs(j - k) <= d) {
                    dp[i][j] = (dp[i][j] + dp[i - 1][k]) % MOD;
                }
            }
        }
    }

    int result = 0;
    for (int j = 0; j < 26; ++j) {
        result = (result + dp[n][j]) % MOD;
    }
   
    return result;
}
๐Ÿ‘1
def min_swaps(s, k):
    k_count = s.count(k)
    if k_count <= 1:
        return 0

    window_size = k_count
    non_k_count = 0
   
    for i in range(window_size):
        if s[i] != k:
            non_k_count += 1
   
    min_swaps = non_k_count
   
    for i in range(window_size, len(s)):
        if s[i - window_size] != k:
            non_k_count -= 1
        if s[i] != k:
            non_k_count += 1
        min_swaps = min(min_swaps, non_k_count)
   
    return min_swaps
def max_errors_in_window(N, error_counts, K):
    if K > N:
        return max(error_counts)

    window_sum = sum(error_counts[:K])
    max_errors = window_sum
   
    for i in range(K, N):
        window_sum = window_sum - error_counts[i-K] + error_counts[i]
        max_errors = max(max_errors, window_sum)
   
    return max_errors

N = int(input())
error_counts = [int(input()) for _ in range(N)]
K = int(input())

result = max_errors_in_window(N, error_counts, K)
print(result)