Codeforces|Leetcode|Codechef free solutions
Open in Telegram
Free codeforces, Codechef, Leetcode solutions are available šššššš Helped More than 200+ students to crack coding round in 2022 and helped placed them in Good companies. š„³š„³š„³š¤©š¤©š¤© Dm @Cpsoln if you want help in coding round.
Show more4 317
Subscribers
No data24 hours
-137 days
-5230 days
Posts Archive
Subscribers the channel guys
If 2250+ subscribers reaches then today's codeforces solutions will be free
Contact me before your coding round and book your slot
100% solutions guaranteed š„š„š„š„š„
ā¼ļøā¼ļøā¼ļøā¼ļøā¼ļøā¼ļøā¼ļøā¼ļøā¼ļøā¼ļø
Solution for all companies will be available
ššššššššššš
Get a special discount
Dm @Cpsoln
ā¼ļøā¼ļøā¼ļøā¼ļøā¼ļøā¼ļøā¼ļøā¼ļøā¼ļøā¼ļøā¼ļøā¼ļø
Don't trust on other telegram channels they will take money and block you
If you want help in JP Morgan coding round then Dm @Cpsoln
int finds(int l)
{
for(int i=2;i*i<=l;i++)
{
if(l%i==0)
{
return i;
}
}
return 1;
}
void solve()
{
int a,b;
cin>>a>>b;
ll x = __gcd(a,b);
if(x>1)
{
cout<<x-1+a/x+b/x<<nline;
return;
}
cout<<min(a,b)+finds(max(a,b))-1+max(a,b)/finds(max(a,b))<<nline;
}
Contact me before your coding round and book your slot
100% solutions guaranteed š„š„š„š„š„
ā¼ļøā¼ļøā¼ļøā¼ļøā¼ļøā¼ļøā¼ļøā¼ļøā¼ļøā¼ļø
Solution for all companies will be available
ššššššššššš
Get a special discount
Dm @Cpsoln
ā¼ļøā¼ļøā¼ļøā¼ļøā¼ļøā¼ļøā¼ļøā¼ļøā¼ļøā¼ļøā¼ļøā¼ļø
Don't trust on other telegram channels they will take money and block you
Codeforces Specialist account available.
More than 400 question solved
Dm @Cpsoln for account
D
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
vector<ll> V;
bool solve(ll x, ll y, ll n){
if(n==1) return true;
if(min(y, V[n+1] - y + 1) > V[n+1] - V[n]) return false;
y = min(y, V[n+1] - y + 1);
return solve(y,x,n-1);
}
int main(){
ll t,n,x1,y1,x2,y2;
cin>>t;
V.push_back(1);
V.push_back(1);
for(int i = 0;i<46;i++) V.push_back(V[i] + V[i+1]);
while(t--){
cin>>n>>x1>>y1;
if(solve(x1,y1,n)) cout<<"YES\n";
else cout<<"NO\n";
}
return 0;
}
Code for A python 3
def ii():
return int(input())
def ai():
return [int(x) for x in input().strip().split()]
for _ in range(ii()):
n,d = ai()
s = input().strip()
ans = ''
done = False
for i in s:
# print(i,ans,done)
if int(i) >= d or (done):
ans += i
else:
ans += str(d)
ans += i
done = True
if not done:
ans += str(d)
print(ans)
B , cpp 17
#include <bits/stdc++.h>
using namespace std;
int find(int x,int y, int n){
x--;y--;
x = min(x, n-x-1);
y = min(y, n-y-1);
return min(x,y);
}
int main(){
int t,n,x1,y1,x2,y2;
cin>>t;
while(t--){
cin>>n>>x1>>y1>>x2>>y2;
cout<<abs(find(x1,y1,n) - find(x2,y2,n))<<"\n";
}
return 0;
}
Code for C cpp 17
#include <bits/stdc++.h>
using namespace std;
int main(){
int t,n,x1,y1,x2,y2;
cin>>t;
while(t--){
int n;
cin>>n;
n--;
vector<int> A(n),B(n+1);
for(int i =0;i<n;i++){
cin>>A[i];
}
bool done = false;
B[0] = A[0];
B[n] = A[n-1];
for(int i = 0;i<n-1;i++){
B[i+1] = min(A[i],A[i+1]);
}
for(int i = 0;i<n+1;i++){
cout<<B[i]<<" ";
}
cout<<"\n";
}
return 0;
}
Problem D cpp 17
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
vector<ll> F;
bool solve(ll x, ll y, ll n){
if(n==1) return true;
// cout<<x<<" "<<y<<" "<<n<<"\n";
if(min(y, F[n+1] - y + 1) > F[n+1] - F[n]){
// cout<<x<<" "<<y<<" "<<n<<" "<<F[n]<<"\n";
return false;
}
y = min(y, F[n+1] - y + 1);
return solve(y,x,n-1);
}
int main(){
ll t,n,x1,y1,x2,y2;
cin>>t;
F.push_back(1);
F.push_back(1);
for(int i = 0;i<46;i++){
F.push_back(F[i] + F[i+1]);
}
while(t--){
cin>>n>>x1>>y1;
if(solve(x1,y1,n)){
cout<<"YES\n";
}else{
cout<<"NO\n";
}
}
return 0;
}
Problem E in Python 3
def ii():
return int(input())
def ai():
return [int(x) for x in input().strip().split()]
def base9(x):
digits = []
base9_int = 0
while x > 0:
digits.append(x % 9)
x = int(x / 9)
for x in digits[::-1]:
base9_int = base9_int * 10 + x
return base9_int
for _ in range(ii()):
n = ii()
s = str(base9(n))
s = s.replace('8', '9')
s = s.replace('7', '8')
s = s.replace('6', '7')
s = s.replace('5', '6')
s = s.replace('4', '5')
print(s)
