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
Hey Coders 👨🏻‍💻, Comment Your City 💬, Let's Know Each Other. And , You Are In ⁉️
Anonymous voting

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

class Solution{ 
  public: 
    void swapElements(int arr[], int n){ 
         
       for(int i=0;i<n-2;i++){ 
            swap(arr[i],arr[i+2]); 
       } 
        
        
    } 
};

Today's 6PM Stock Update. Do You Redeem Anything ⁉️
Anonymous voting

⚡️⚡️ Update ⚡️⚡️ 🔸 Sipper is in STOCK ✨ Order Nowww 🔥🔥🔥 GFG Reward
⚡️⚡️ Update ⚡️⚡️ 🔸 Sipper is in STOCK ✨ Order Nowww 🔥🔥🔥 GFG Reward

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

class Solution{ 
public: 
 static bool cmp(string a,string b){ 
       return a+b>b+a; 
   } 
    string printLargest(int n, vector<string> &arr) { 
        sort(arr.begin(),arr.end(),cmp); 
        string ans=""; 
        for(int i=0;i<n;i++){ 
            ans+=arr[i]; 
        } 
        while(ans[0]=='0' && ans.length()>1) ans.erase(0,1); 
        return ans; 
    } 
};

⚡⚡ Update ⚡⚡ 🔸New Swag Added To GFG Reward List
⚡⚡ Update ⚡⚡ 🔸New Swag Added To GFG Reward List

2nd March : C++ Solution☝🏼 ———————————————————— 🙋🏻‍♂️Discussion ⁉️ Join ✅ @GFG_Answer

class Solution{ 
    public: 
    int firstElementKTime(int n, int k, int a[]) 
    { 
        std::unordered_map<int, int> map; 
        for(int i=0; i<n; i++){ 
            map[a[i]]++; 
            if(map[a[i]] == k) 
                return a[i]; 
        } 
        return -1; 
    } 
};

1st March : C++ Solution☝🏼 ———————————————————— 🙋🏻‍♂️Discussion ⁉️ Join ✅ @GFG_Answer

// arr: input array 
// n: size of array 
class Solution 
{ 
    public: 
    int peakElement(int arr[], int n) 
    { 
       for(int i=1;i<n;i++){ 
           if(arr[i]<arr[i-1]) 
              return i-1; 
       } 
       return n-1; 
    } 
};

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

class Solution{ 
public: 
  
 long long sumBitDifferences(int arr[], int n) { 
        long long ans = 0; 
         
        for(int k=0;k<32;k++){ 
            int ct1 = 0; 
            int ct0 = 0; 
            for(int i=0;i<n;i++){ 
                int t = ((arr[i]>>k)&1); 
                if(t==1){ 
                    ct1++; 
                } 
                else{ 
                    ct0++; 
                } 
            } 
            ans+=(ct1*(1ll)*ct0); 
        } 
         
        return ans*2; 
 } 
};

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

class Solution{ 
    public: 
    int DivisibleByEight(string s){  
          int n=s.length(); 
        int l=stoi(s.substr(max(n-3,0))); 
        return l%8==0?1:-1; 
    } 
};

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

int* game_with_number(int arr[], int n) 
{ 
    for(int i =0; i < n-1; ++i){ 
        arr[i] = arr[i] | arr[i+1]; 
    } 
    return arr; 
}

int* game_with_number(int arr[], int n) { for(int i =0; i < n-1; ++i){ arr[i] = arr[i] | arr[i+1]; } return arr; }

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