GEEKS FOR GEEKS SOLUTIONS🫢
Open in Telegram
1 342
Subscribers
No data24 hours
-27 days
-2930 days
Posts Archive
class Solution{
public:
/*You are required to complete this method*/
int maxDepth(Node *root) {
// Your code here
if(root == NULL)
{
return 0;
}
return max(maxDepth(root->left), maxDepth(root->right)) + 1;
}
};
⚡️Get 100% Free Scholarship ⚡️
Get Premium Courses Worth Lakhs For Free 📂
Get Free Bags🎒 / T-shirts 👕
Free Certification 📃
Eligibility: Anyone Can Join ✅
Fees: ZERO 😍
Last Date: 28th June 📥
Try your Luck Guys 👀
✅ Register Now: https://www.codingninjas.com/studio/contests/scholarship-test-27th-to-28th-june-2023?utm_source=Growth-CS&utm_medium=RJ&utm_campaign=TechVineChannel_Hardik_28June
Giveaway Time ✨🙌
Rest assured, This is type of collab and 50% of the money earned will be shared with this community, I have done this type of event last year also so you can trust this ..
class Solution
{
public:
struct Node* makeUnion(struct Node* head1, struct Node* head2)
{
vector vec;
unordered_map mp;
for(auto it= head1; it; it= it->next){
if(!mp[it->data])vec.push_back(it->data);
mp[it->data]++;
}
for(auto it = head2;it; it= it->next){
if(!mp[it->data]) vec.push_back(it->data);
mp[it->data]++;
}
sort(begin(vec), end(vec));
Node* head= new Node(vec[0]);
Node* tail= head;
for(int i=1;i< vec.size();i++){
Node* newnode= new Node(vec[i]);
tail->next= newnode;
tail= newnode;
}
return head;
}
};
class Solution
{
public:
// #define MAX 1000
vector<vector<int>> uniqueRow(int M[MAX][MAX],int row,int col)
{
set<vector<int>> st;
vector<vector<int>> ans;
for(int i=0;i<row;i++)
{
vector<int> v;
for(int j=0;j<col;j++)
v.push_back(M[i][j]);
if(st.count(v)==0)
{
st.insert(v);
ans.push_back(v);
}
}
return ans;
}
};
👋 Hello Everyone! 🎉 I have made this Telegram Group for Arcade Facilitator Program Phase 2. 🕹 This phase will start in the beginning of July month.
👉 Join this group... 💪
https://t.me/arcade_facilitator_techvine
class Solution{
public:
int klengthpref(string arr[], int n, int k, string str){
int ans = 0;
for(int i=0;i
public:
int leastInterval(int N, int k, vector &tasks) {
vector v(26,0);
for(auto x:tasks)++v[x-'A'];
int n=*max_element(v.begin(),v.end());
int f=0, res=(n-1)*k+n;
for(int i=0;i<26;++i)
{
if(v[i]
bool lemonadeChange(int n, vector &bills) {
// code here
int cnt5=0,cnt10=0;
for(int i=0;i=1 and cnt5>=1){
cnt10--;
cnt5--;
}
else if(cnt10==0 and cnt5>=3){
cnt5-=3;
}
else{
return false;
}
}
}
return true;
}
class Solution {
public:
int sumOfNaturals(int n) {
const int MOD = 1000000007;
long long sum = ((long long)n * (n + 1)) / 2;
return sum % MOD;
}
};
class Solution {
public:
int matchGame(long long n) {
return (n%5==0)?-1:n%5;
}
};
