๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
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
def string_replacement(word, substr):
    n = len(word)
    m = len(substr)
    j = 0
    word = list(word)
    for i in range(n):
        if word[i] == '?':
            if j < m:
                word[i] = substr[j]
                j += 1
            else:
                return "-1"
    if j < m:
        return "-1"
    return ''.join(word)

String Replacement
Python 3โœ…
JP Morgan
#include<bits/stdc++.h>
using namespace std;
int a[100][100];
int N,K,M;      
int getmax(int t,int q,int Z,int Y)   
{
    int max=0;
    for(int i=t;i<Z;i++)
    {
       for(int j=q;j<Y;j++)
       {
           if (max<a[i][j])
          {
              max=a[i][j];
          }

       }

    }
return max;

}

int main()
{

cin>>N>>K>>M;

for(int i=0;i<N;i++)     
    for(int j=0;j<N;j++)
{

    cin>>a[i][j];
}


int i,j;

vector<int>p;  

for(int i=0;i<N;i++)
{
    for(int j=0;j<N;j++)
    {
         if((j+K)<=N &&(i+K)<=N)     
        {


        int x =getmax(i,j,i+K,j+K);  
         p.push_back(x);
         }
    }


}
vector<int>u;  

cout<<"\n\nP array=";
for(int i=0;i<p.size();i++)
   {
     cout<<p[i]<<" ";
     if(p[i]>=M)
     {
        u.push_back(p[i]);

     }

   }
cout<<"\n\nOUTPUT:";
cout<<endl<<u.size()<<" "<<*min_element(u.begin(), u.end())<<" "<<*max_element(u.begin(), u.end());

return 0;


}

submatrix maximum
Urban โœ…
#include <iostream>


using namespace std;


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

int parent[N + 1];
for (int i = 0; i <= N; i++) {
parent[i] = 0;
}

for (int i = 0 ; i < N - 1; i++) {
int u, v;
cin >> u >> v;
parent[v] = u;
}

int Q;
cin >> Q;
for (int i = 0; i < Q; i++) {
int p, c;
cin >> p >> c;

bool found = false;
while (c != 0) {
c = parent[c];
if (c == p) {
found = true;
break;
}
}

if (found) {
cout << "1" << endl;
}
else {
cout << "0" << endl;
}
}

return 0;
}

Tree Relation
Urban โœ…
๐Ÿ‘1
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

ll divisors(ll num) {
    ll cnt = 0;
    for(ll d = 1; d * d <= num; d++) {
        if (num % d == 0) {
            cnt+=1+(num/d!=d);
           // cnt += (num / d == d) ? 1 : 2;
        }
    }
    return cnt;
}

ll numOfSubarrays(vector<ll> &nums) {
    ll odd = 0, even = 0, sum = 0;
    for (ll num : nums) {
        if (divisors(num) & 1) {
            swap(odd, even);
            ++odd;
        } else {
            ++even;
        }
        sum += odd;
    }
    return sum;
}

int main() {
    int n;
    cin >> n;
    vector<ll> nums(n);
    for (ll &num : nums) cin >> num;
    cout << numOfSubarrays(nums);
    return 0;
}

Chaotic Subarrays
Urban โœ…
๐Ÿ‘1
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
#include<bits/stdc++.h> using namespace std; using ll = long long; ll divisors(ll num) {     ll cnt = 0;     for(ll d = 1; d * d <= num; d++) {         if (num % d == 0) {             cnt+=1+(num/d!=d);            // cnt += (num / d == d) ? 1 : 2;        โ€ฆ
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

ll countSubarray(int N, vector<ll> &A) {
    ll odd = 0, even = 0, sum = 0;
    for (ll num : A) {
        ll sqrtNum = sqrt(num);
        if (sqrtNum * sqrtNum == num) {
            swap(odd, even);
            ++odd;
        } else {
            ++even;
        }
        sum += odd;
    }
    return sum;
}

int main() {
    int n;
    cin >> n;
    vector<ll> A(n);
    for (ll &num : A) cin >> num;
    cout << countSubarray(n, A);
    return 0;
}.

Chotic subarray โœ…
Urban
๐Ÿ˜ฑ1
๐Ÿ“ŒTechGig Code Gladiators 2024: Unlock your career journey !!

๐Ÿ”“ Unlock job and internship opportunities through this coding contest.

- Compete With The Best
- Gain Industry Recognition
- Land Your Dream Job
- Win Big

Win prizes worth Rs 10 Lakhs ๐Ÿ’ฐ and earn the title of Best Coder of the World ๐ŸŒŽ

๐Ÿ”—Apply now at:
https://bit.ly/43MyDza

Share this opportunity with your friends ๐Ÿš€.
ZS is Hiring for its Business Technology Solutions Team @ Pune!

Role: Business Technology Solutions Associate (BTSA)
Experience: 0-3 Years
Location: Pune
Notice Period: Immediate joiners only

Qualifications:
- Bachelor's degree in Computer Science or related field
- Skills in ETL technologies (Informatica, Talend, SSIS), data warehousing, and SQL
- Exposure to Cloud Platforms (AWS, Azure, GCP) a plus

Additional Skills:
- Strong communication and problem-solving abilities
- Ability to work in a global team environment
- Willingness to travel as needed


Please send your resume to manish.khatri@zs.com
#include <iostream>
#include <algorithm>

using namespace std;

#define ll long long

ll solve(int s1, int s2, int p) {
    ll minT1 = p / s1;
    ll rem1 = p % s1;

    while (minT1 >= 0) {
        if (rem1 % s2 == 0) {
            break;
        }
        minT1--;
        rem1 += s1;
    }

    ll minT2 = p / s2;
    ll rem2 = p % s2;

    while (minT2 >= 0) {
        if (rem2 % s1 == 0) {
            break;
        }
        minT2--;
        rem2 += s2;
    }

    if (minT1 < 0 && minT2 < 0) {
        return -1;
    } else if (minT1 < 0) {
        return minT2 + rem2 / s1;
    } else if (minT2 < 0) {
        return minT1 + rem1 / s2;
    } else {
        return min(minT1 + rem1 / s2, minT2 + rem2 / s1);
    }
}

int main() {
    int s1, s2, p;
    cin >> s1 >> s2 >> p;
    cout << solve(s1, s2, p) << endl;
    return 0;
}

Track in Hackathon โœ…
โค1
int getPotentialOfWinner(vector<int> potential, long k)
{
    int n = potential.size();

    int x = potential[0];
    int m = 0;
    for (int i = 1; i < n; i++)
    {
        if (m != k)
        {
            if (x > potential[i])
            {
                m++;
            }
            else
            {
                x = potential[i];
                m = 1;
            }
        }
    }

    return x;
}

Chess Tournament โœ…
๐Ÿ‘1