๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
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
Please try to react on the post in case you are applying, it will hardly take your 10 secs but enough to motivate me to share more and more opportunities everyday without fail:)

Just one favour if you canโค๏ธ
โค11๐Ÿคฉ3
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 ๐Ÿš€.