๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.62K subscribers
5.59K photos
3 videos
95 files
10.2K links
๐ŸšฉMain Group - @SuperExams
๐Ÿ“Job Updates - @FresherEarth

๐Ÿ”ฐAuthentic Coding Solutions(with Outputs)
โš ๏ธDaily Job Updates
โš ๏ธHackathon Updates & Solutions

Buy ads: https://telega.io/c/cs_algo
Download Telegram
#include <iostream>
#include <vector>
using namespace std;
int countDigits(int num) {
    int count = 0;
    while (num > 0) {
        num /= 10;
        count++;
    }
    return count;
}
int solution(vector<int>& numbers) {
    int e = 0;
    for (int num : numbers) {
        int digitCount = countDigits(num);
        if (digitCount % 2 == 0) {
            e++;
        }
    }
   
    return e;
}


Visa โœ…
๐Ÿ‘1
def solution(target):
    result = [target[0]]
   
    for i in range(1, len(target) - 1):
        if target[i] > max(target[i - 1], target[i + 1]):
            result.append(target[i])
   
    result.append(target[-1])
    return result

Visa โœ…
#include <vector>
#include <algorithm>
using namespace std;

const int MOD = 1e9 + 7;

vector<int> satisfyHunger(const vector<int>& hunger, const vector<int>& calories) {
    int max_hunger = *max_element(hunger.begin(), hunger.end());
    int m = calories.size();
    
     vector<int> dp(max_hunger + 1, 0);
    dp[0] = 1; 
    for (int c = 0; c < m; ++c) {
        for (int j = calories[c]; j <= max_hunger; ++j) {
            dp[j] = (dp[j] + dp[j - calories[c]]) % MOD;
        }
    }
    vector<int> result(hunger.size(), 0);
    for (int i = 0; i < hunger.size(); ++i) {
        result[i] = dp[hunger[i]];
    }

    return result;
}

GFG intern โœ…
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include <algorithm>
#include <iostream>
using namespace std;

// Function to check if two strings are anagrams
bool areAnagrams(string s1, string s2)
{
    // Sort both strings
    sort(s1.begin(), s1.end());
    sort(s2.begin(), s2.end());

    // Compare sorted strings
    return s1 == s2;
}

int main()
{
    string str1 = "listen";
    string str2 = "silent";

    if (areAnagrams(str1, str2)) {
        cout << "True" << endl;
    }
    else {
        cout << "False" << endl;
    }

    str1 = "gram";
    str2 = "arm";

    if (areAnagrams(str1, str2)) {
        cout << "True" << endl;
    }
    else {
        cout << "False" << endl;
    }

    return 0;
}

GFG intern โœ…
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

vector<string> solve(int N, const vector<vector<string>>& input) {
    vector<pair<int, char>> in;

    for (const auto& vec : input) {
        int number = stoi(vec[0]);
        char symbol = vec[1][0];
        in.emplace_back(number, symbol);
    }
    sort(in.begin(), in.end());

    string msgs;
    int s = -1;
    vector<string> result;
    for (const auto& p : in) {
        msgs += p.second;
    }
    for (size_t i = 0; i < msgs.size(); i++) {
        if (msgs[i] == '*') {
            if (s != -1) {
                string msg = msgs.substr(s + 1, i - s - 1);
                string out;
                char last = '\0';
               
                for (char c : msg) {
                    if (c != last) {
                        out += c;
                        last = c;
                    }
                }

                if (!out.empty()) {
                    result.push_back(out);
                }
            }
            s = i;
        }
    }

    return result;
}


Message Parsingโœ…
#include <bits/stdc++.h>
using namespace std;
#define int long long

int solution(int A, int B) {
    if (A > B) {
        return A - B;
    }

    int mini = INT_MAX;
    int count = 0;

    for (int i = A; i <= B; i++) {
        int mod = B % i;
        int ans = count;

        if (mod)
            ans += (i - mod);

        mini = min(mini, ans);
        count++;
    }

    return mini;
} m

ultiple โœ…
class node{
  public:
  long ind;
  char c;
  int t;
  node()
  {
   
  }
  node(long ind,char c,int t)
  {
    this->ind=ind;
    this->c=c;
    this->t=t;
  }
};
bool cmp(node &a,node &b)
{
  if(a.ind<b.ind)return true;
  else return false;
}
vector<string>fun(int n,vector<vector<string>>messages)
{
  vector<node>v(n);
  for(int i=0;i<n;i++)
  {
    long ind=stol(messages[i][0]);
    char c=messages[i][1][0];
    int t=i;
    node temp(ind,c,t);
    v[i]=temp;
  }
  sort(v.begin(),v.end(),cmp);
  vector<pair<int,string>>check;
  vector<string>ans;
  for(int i=0;i<n;i++)
  {
    if(v[i].c=='*')
    {
      int j=i+1;
      while(j<n&&v[j].c!='*'&&v[j-1].ind+1==v[j].ind)j++;
      if(v[j].c=='*')
      {
        int mx=0;
        string temp="";
        for(int k=i+1;k<j;k++)temp.push_back(v[k].c);
        for(int k=i;k<=j;k++)mx=max(mx,v[k].t);
        check.push_back({mx,temp});
      }
    }
  }
  sort(check.begin(),check.end());
  for(int i=0;i<check.size();i++)ans.push_back(check[i].second);
  return ans;
}

String Parse โœ…
๐Ÿ‘1