coderhelp234 | Unsorted

Telegram-канал coderhelp234 - Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

767

@Codeforces_Codechef_freesolution

Subscribe to a channel

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

Company Name : Lowe’s
Batch : 2024/2023 passouts
Role : Associate Software Engineer

Link : https://talent.lowes.com/in/en/job/JR-01854460/Associate-Software-Engineer

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

Company Name : Dream11
Role : Software Engineer - 1

Batch : 2022/2023/2024 passouts

Link : https://jobs.lever.co/dreamsports/93fe293c-f410-481e-93f4-005795c29788

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

#include <iostream>
using namespace std;

int largestRectangleArea(int N) {
int maxArea = 0;

// Iterate over possible values of l (length)
for (int l = 1; l <= N / 2; ++l) {
int w = (N / 2) - l; // Calculate width
if (w > 0) {
maxArea = max(maxArea, l * w); // Update max area
}
}

return maxArea;
}

int main() {
int T; // Number of test cases
cin >> T;

while (T--) {
int N;
cin >> N;
cout << largestRectangleArea(N) << endl;
}

return 0;
}
//Rectangled

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

Company: FocusFlow
Profile: Mobile App Developer Intern
No. of Openings: 3

Link:
https://cuvette.tech/app/public/internship/66fe18f16fafc8dfd3bbe04c?referralCode=S0GINI

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

Company: Uber
Job: 6 month intern SDE
Batch : 2025/2026
Stipened: 1,77,000

Link: https://university-uber.icims.com/jobs/136121/

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

#include <iostream>
#include <vector>
using namespace std;

long long gcd(long long a, long long b)
{
if (b == 0) return a;
return gcd(b, a % b);
}

int main()
{
int test;
cin >> test;
while (test--) {
int n;
long long k;
cin >> n >> k;

vector<long long> arr(n);
for (int i = 0; i < n; i++) {
cin >> arr[i];
}


bool same = true;
for (int i = 0; i < n; i++) {
if (arr[i] != k) {
same = false;
break;
}
}

if (same)
{
cout << 0 << endl;
}
else
{

int start = -1, end = n;
for (int i = 0; i < n; i++) {
if (arr[i] != k) {
if (start == -1) start = i;
end = i;
}
}


if (start == end)
{
cout << 1 << endl;
}
else
{
bool allXORSame = true, allDivisibleByK = true;
long long firstXOR = (arr[start] ^ k);

for (int i = start; i <= end; i++) {
if (arr[i] % k != 0) allDivisibleByK = false;
if ((arr[i] ^ k) != firstXOR) allXORSame = false;
}

if (allXORSame || allDivisibleByK)
{
cout << 1 << endl;
} else
{
cout << 2 << endl;
}
}
}
}
return 0;
}

// GCD AND Xor

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

#include<bits/stdc++.h>
using namespace std;
#define int long long

int32_t main()
{
int t;
cin>>t;

while(t--)
{
int n,k;
cin>>n>>k;

vector<int>vec(n);
for(int i=0;i<n;i++)
{
cin>>vec[i];
}

int sum=0;
int cnt=0;

for(int i=0;i<n;i++)
{
sum+=vec[i];
if(sum<=k)
{
cnt++;
}
else
{
break;
}
}

cout<<cnt<<endl;
}
return 0;
}

// Calorie limit

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

Company: CornerStone
Role: SDE Intern
Location: Pune, India
Batch: 2025

Apply here: https://cornerstone.csod.com/ux/ats/careersite/2/home/requisition/9860?c=cornerstone

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

Any Upcoming OA/OLT whose help you need free ?

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

All processes are treated equally by the OS and shared a common memory ( Option B)

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

Ratio of number of elements to the number of slots( option -C)

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

Self adjusting rearrange nodes based on frequency (option B)

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

Option D - south East

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

Next Contest ---
Codeforces Round 2 on 20th september

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

#include<bits/stdc++.h>
using namespace std;
#define int long long

int32_t main()
{
int t;
cin>>t;

while(t--)
{
int n,m;
cin>>n>>m;

vector<pair<int,pair<int,int>>>vec(n);

int ans=0;

while(m--)
{
string s;
cin>>s;


int a=0;
int b=0;
int c=0;

for(int i=0;i<s.size();i++)
{
if(s[i]=='0')
{
vec[i].first++;
}
else if(s[i]=='1')
{
vec[i].second.first++;
}
else
{
vec[i].second.second++;
}
}

}

for(int i=0;i<n;i++)
{
int a=vec[i].first;
int b=vec[i].second.first;
int c=vec[i].second.second;

while(c--)
{
if(a<=b)
{
a++;
}
else
{
b++;
}
}

ans+=(a*b);

//cout<<i<<" "<<a<<" "<<b<<" "<<ans<<endl;
}


cout<<ans<<endl;

}


return 0;
}

// Maximize hamming distance

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

Company Name: Synopsys
Role: Software Engineer
Batch eligible: 2024 grads (2025 can try but chances are very low)

Apply: https://careers.synopsys.com/job/-/-/44408/71068434688?codes=OT

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

#include <iostream>
using namespace std;

int main() {
int X; // Number of days Chef spent in prison
cin >> X;

// Check if Chef has spent at least 7 days
if (X >= 7) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}

return 0;
}
//Chef and Parole

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

#include <bits/stdc++.h>
using namespace std;

int main() {
int t;
cin>>t;
while(t--){
int n,m;
cin>>n>>m;
int a[n][m];
for(int i=0; i<n; i++){
for(int j=0; j<m; j++)a[i][j]=2;
}
if(n>m){
for(int i=0; i<m; i++){
a[i][i]=3;
}
for(int i=m; i<n; i++){
a[i][0]=3;
}
}
else{
for(int i=0; i<n; i++){
a[i][i]=3;
}
for(int i=n; i<m; i++){
a[0][i]=3;
}
}
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
cout<<a[i][j]<<" ";
}
cout<<endl;
}
}
}
//GCD to 1 (Hard)

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

Company: Hackerrank
Role: SDE intern ( 6 months)
Batch: 2025/2026

Link: https://boards.greenhouse.io/hackerrank/jobs/6241442?gh_jid=6241442&amp;gh_src=KrishanKumarLinkedin

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

void readInputVector(vector<long long>& inputVector, long long numberOfElements) {
for (long long index = 0; index < numberOfElements; ++index) {
cin >> inputVector[index];
}
}

vector<pair<long long, long long>> generateEventPoints(const vector<long long>& sortedVector, long long numberOfElements) {
vector<pair<long long, long long>> eventPoints;

for (long long index = 0; index < numberOfElements - 1; index++) {
long long difference = sortedVector[index + 1] - sortedVector[index];
long long startPoint = sortedVector[index + 1] - sortedVector[index] + 1;
long long endPoint = sortedVector[index + 1] + sortedVector[index] - 1;

eventPoints.push_back({startPoint, 1}); // Adding a start event
eventPoints.push_back({endPoint + 1, -1}); // Adding an end event
}
return eventPoints;
}

long long countDistinctNumbers(vector<pair<long long, long long>>& eventPoints) {
sort(eventPoints.begin(), eventPoints.end());
long long activeIntervals = 0;
long long previousEventPosition = -1;
long long totalDistinctCount = 0;

for (const auto& event : eventPoints) {
long long currentEventPosition = event.first;
long long eventType = event.second;

if (previousEventPosition != -1 && activeIntervals > 0) {
totalDistinctCount += (currentEventPosition - previousEventPosition);
}

if (eventType == 1) {
activeIntervals++; // Start of an interval
}
if (eventType == -1) {
activeIntervals--; // End of an interval
}

previousEventPosition = currentEventPosition;
}
return totalDistinctCount;
}

void solveSingleTestCase() {
long long numberOfElements;
cin >> numberOfElements;

vector<long long> inputVector(numberOfElements);
readInputVector(inputVector, numberOfElements);
sort(inputVector.begin(), inputVector.end());

vector<pair<long long, long long>> eventPoints = generateEventPoints(inputVector, numberOfElements);
long long totalDistinctCount = countDistinctNumbers(eventPoints);
cout << totalDistinctCount << endl;
}

int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);

long long numberOfTestCases;
cin >> numberOfTestCases;

for (long long testCaseIndex = 0; testCaseIndex < numberOfTestCases; ++testCaseIndex) {
solveSingleTestCase();
}
return 0;
}

// Triangle count(easy)

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

#include <iostream>
using namespace std;

int main() {
int T;
cin >> T;
while (T--) {
int N;
cin >> N;

if (N == 1) {
cout << "ALICE" << endl;
} else {
cout << "BOB" << endl;
}
}

return 0;
}

// Add 1 or 2

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

#include<bits/stdc++.h>
using namespace std;
#define int long long

int32_t main()
{
int n;
cin>>n;

cout<<(n+1)*5000<<endl;

return 0;
}

// Coldplay Tickets

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

Company: Myntra
Position : Software Engineer
Qualification: Bachelor’s/ Master’s Degree
Salary: 21 LPA
Experience : Freshers
Location : Bangalore, India

📌Apply Link: https://careers.myntra.com/job-detail/?id=7434053002

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

Any one good at CS fundamental and aptitude dm @Matrics12345 for some work and they will be paid accordingly

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

Neither BFS nor DFS ( option D)

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

Dijkstra shortest path algorithm (option C)

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

Option B - northwest

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

Juspay question and answers will be uploaded here

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

#include <bits/stdc++.h>
using namespace std;

int main()
{
int t;
cin >> t;
while(t--)
{
int n, q;
cin >> n >> q;
vector<int> a(n + 1);

for(int i = 1; i <= n; i++)
{
cin >> a[i];
}


vector<int> c1(n + 1, 0), c2(n + 1, 0), c3(n + 1, 0);


for(int i = 1; i <= n; i++)
{
c1[i] = c1[i - 1] + (a[i] == 1);
c2[i] = c2[i - 1] + (a[i] == 2);
c3[i] = c3[i - 1] + (a[i] == 3);
}


while(q--)
{
int l, r;
cin >> l >> r;
int m = r - l + 1;
if(m % 2 != 0)
{
cout << "No" << endl;
continue;
}


int k = m / 2;
int some = c1[r] - c1[l - 1];
int full = c2[r] - c2[l - 1];
int whole = c3[r] - c3[l - 1];
int cnt = 0;


if(some >= k) cnt++;
if(full >= k) cnt++;
if(whole >= k) cnt++;

if(some <= k && full <= k && whole <= k && cnt >= 1)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
}
return 0;
}

// Anti palindrome

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

#include<bits/stdc++.h>
using namespace std;
#define int long long

int32_t main()
{
int t;
cin>>t;

while(t--)
{
int n;
cin>>n;

vector<int>vec(n);
for(int i=0;i<n;i++)
{
cin>>vec[i];
}

sort(vec.begin(),vec.end());

int ans1=vec[n-3]-vec[0];
int ans2=vec[n-1]-vec[2];
int ans3=vec[n-2]-vec[1];

cout<<min(ans1,min(ans2,ans3))<<endl;

}


return 0;
}

// Range minimize

Читать полностью…
Subscribe to a channel