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
Repost from Codeforces|Leetcode|Codechef free solutions
Today's zscalar slot done🤩🤩
Dm @Cpsoln for coding round help
Repost from Codeforces|Leetcode|Codechef free solutions
Microsoft slot done 🥳
Dm @Cpsoln for help in coding rounds of any company
Repost from Codeforces|Leetcode|Codechef free solutions
Today's tesco slots done ✅✅✅
Dm @Cpsoln for coding round help
Repost from Codeforces|Leetcode|Codechef free solutions
Today's atlassian slot done🥳🥳🥳
Dm @Cpsoln for any coding round help
Repost from Codeforces|Leetcode|Codechef free solutions
Deutsche bank today's slot done 🥳
Dm @Cpsoln for coding round help
Repost from Codeforces|Leetcode|Codechef free solutions
Celigo oa slot done
If you want to book slot for oa then Dm @Cpsoln
class Solution {
public:
int count;
int dfs(int i,vector> &adj,vector &a,int k,int par){
int val=0;
for(int j=0;j>& edges, vector& values, int k) {
vector> adj(n);
for(int i=0;i
In case if it is not working then try this
class Solution { public: int maxSubarrays(vector &ll) { int r = INT_MAX; for (auto i : ll) r &= i; if (r != 0) return 1; int c = INT_MAX, seg = 0; for (auto i : ll) { c &= i; if (c == r) { seg++; c = INT_MAX; } } return seg; } };
#include <vector>
#include <climits>
class Solution {
public:
int maxSubarrays(vector<int> &ll) {
int r = INT_MAX;
for (auto i : ll)
r &= i;
if (r != 0)
return 1;
int c = INT_MAX, seg = 0;
for (auto i : ll) {
c &= i;
if (c == r) {
seg++;
c = INT_MAX;
}
}
return seg;
}
};
class Solution {
public:
int minOperations(vector<int>& v) {
map<int,int>m;
for(auto it:v){
m[it]++;
}
int ans=0;
for(auto it:m){
if(it.second<2)return -1;
ans+=((it.second+2)/3);
}
return ans;
}
};
Leetcode B
class Solution {
public:
int minOperations(vector& nums, int k) {
reverse(nums.begin(),nums.end());
int count = 0;
set s;
int f = 0;
for(auto val:nums){
if(val<=k){
s.insert(val);
}
count++;
if(s.size()==k){
f = 1;
break;
}
}
if(f==1){
return count;
}
return -1;
}
};
Leetcode A
Leetcode A
class Solution {
public:
int minOperations(vector<int>& v) {
map<int,int>m;
for(auto it:v){
m[it]++;
}
int ans=0;
for(auto it:m){
if(it.second<2)return -1;
ans+=((it.second+2)/3);
}
return ans;
}
};
Leetcode B
