es
Feedback
GeeksForGeeks - POTD | GFG POTD Answer

GeeksForGeeks - POTD | GFG POTD Answer

Canal cerrado

🚩 Channel was restricted by Telegram

Mostrar más
1 218
Suscriptores
Sin datos24 horas
-97 días
-5730 días
Archivo de publicaciones
sticker.webp0.04 KB

30th October : C++ Solution ☝🏼 ————————————————————— 🙋🏻‍♂️Discussion ⁉️ Join ✅ @GFG_Answer

class Solution{ public: // Returns sum of bitwise OR // of all pairs long long int sumXOR(int arr[], int n) { long long int sum = 0; for (int i = 0; i < 32; i++) { long long int zerocount = 0, onecount = 0; long long int idsum = 0; for (int j = 0; j < n; j++) { if (arr[j] % 2 == 0) zerocount++; else onecount++; arr[j] /= 2; } idsum = onecount * zerocount * (1 << i); sum += idsum; } return sum; } };

29th October : C++ Solution ☝🏼 ————————————————————— 🙋🏻‍♂️Discussion ⁉️ Join ✅ @GFG_Answer

class Solution { public: bool checkKthBit(int n, int k) { return (n & (1 << k)); } };

28th October : C++ Solution ☝🏼 ————————————————————— 🙋🏻‍♂️Discussion ⁉️ Join ✅ @GFG_Answer

class Solution { public: int countSetBit(int n){ int ans=0; while(n){ if(n&1) ans++; n/=2; } return ans; } int is_bleak(int n) { int j=1; while((1<

27th October : C++ Solution ☝🏼 ————————————————————— 🙋🏻‍♂️Discussion ⁉️ Join ✅ @GFG_Answer

class Solution{ public: // Longest Palindromic Subsequence int minimumNumberOfDeletions(string s) { int n = s.size(); string temp = s; reverse(temp.begin(), temp.end()); vector prev(n + 1), curr(n + 1); for(int i = 1; i <= n; i++) { for(int j = 1; j <= n; j++) { if(s[i - 1] == temp[j - 1]) curr[j] = 1 + prev[j - 1]; else curr[j] = max(prev[j], curr[j - 1]); } prev = curr; } return n - prev[n]; } };

26th October : C++ Solution ☝🏼 ————————————————————— 🙋🏻‍♂️Discussion ⁉️ Join ✅ @GFG_Answer

class Solution { public: int minOperation(int n) { if(n==1) return 1; if(n%2==0) return minOperation(n/2)+1; else{ return minOperation(n-1)+1; } } };

25th October : C++ Solution ☝🏼 ————————————————————— 🙋🏻‍♂️Discussion ⁉️ Join ✅ @GFG_Answer

class Solution{ public: int dp[1001][1001]; int f(int W, int wt[], int val[], int n) { if(W<=0||n==0) return 0; if(dp[W][n]!=-1) return dp[W][n]; if(wt[n-1]<=W) return dp[W][n] = max(f(W,wt,val,n-1),(f(W-wt[n-1],wt,val,n)+val[n-1])); else return dp[W][n] = f(W,wt,val,n-1); } int knapSack(int n, int W, int val[], int wt[]) { memset(dp,-1,sizeof(dp)); return f(W,wt,val,n); } };

24th October : C++ Solution ☝🏼 ————————————————————— 🙋🏻‍♂️Discussion ⁉️ Join ✅ @GFG_Answer

class Solution{ public: bool isPalindrome(int i,int j,string &s){ while(idp(str.size()+1,0); for(int i=str.size()-1;i>=0;i--){ int mincost=INT_MAX; for(int j=i;j

‼️NEED HELP‼️ I Want To Buy A Laptop 💻 ⚠️Budget : 45k-48k⚠️ 🔸CSE student 🔰Need : Coding & Video Editing ⭐Best Laptop Suggest Please⭐ ⚡Comment Down⬇️

23rd October : C++ Solution ☝🏼 ————————————————————— 🙋🏻‍♂️Discussion ⁉️ Join ✅ @GFG_Answer

class Solution{ public: int maxSumIS(int arr[], int n) { int ans=INT_MIN; vectordp(n); for(int i=0;i

✨🔰🔰🔰🔰🔰🔰🔰✨ ✨🔰COURSES 🔰✨ ✨🔰🔰🔰🔰🔰🔰🔰✨ 1⃣ D0T \/\/ĒB D€V 2⃣ $upr€m€ DS∆ 3⃣ P\/\/ W€B D€V 4⃣ ∆LPH∆ B@tch 5⃣ UDMY ∆NDR01D D€V ⚠️How To Access Link⚠️ ✨SHARE WITH YOUR FRIENDS✨

‼️Those Who Only Collect GeekBits‼️ ✨You'll Get 2 Geekbits✨ Go To This Link - WEEKLY_125 And Paste This Answer ⬇️⬇️ 👉🏼On 1st Question (CPP)👈🏼 ⚡Q. 1⚡ ====================== ⚠️We Provide Only POTDs⚠️ But Most Of Our Subscribers Collect GeekBits. By Solving One Weekly Que. Can Be Earn 2 GeekBits. If You Don't Solve All Ques. Still You Get Only 2 GeekBits For Participation. ======================