๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.52K subscribers
5.56K photos
3 videos
95 files
9.66K 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
def check_similar_passwords(new_passwords, old_passwords):
    ans = []

    for new_pass, old_pass in zip(new_passwords, old_passwords):
        i, j = 0, 0
        while i < len(new_pass) and j < len(old_pass):
            new_char = new_pass[i]
            old_char = old_pass[j]
           
            new_shifted_char = 'a' if new_char == 'z' else chr(ord(new_char) + 1)
           
            if old_char == new_char or old_char == new_shifted_char:
                j += 1
            i += 1
       
        ans.append("YES" if j == len(old_pass) else "NO")

    return ans

new_passwords = ["aaccbbee", "aab"]
old_passwords = ["bdbf", "aee"]
print(check_similar_passwords(new_passwords, old_passwords))


Python 3โœ…
(Amazon)
#include <bits/stdc++.h>

using namespace std;

int getMaxCount(vector<int>people,vector<char>status){
    int i=0;
    int ans=0;
    map<int,int>mp;
    int n=status.size();
    for(int i=0;i<n;i++){
        int bro=people[i];
        if(status[i]=='-'){
            mp[bro]--;
            if(mp[bro]==0){
                mp.erase(bro);
            }
           

        }else{
            mp[bro]++;

        }
        int helo=mp.size();
        ans=max(ans,helo);
    }
    return ans;

}

int main() {
  int n;
  cin>>n;
  vector<int>vec(n);
  vector<char>vec2(n);
  for(int i=0;i<n;i++){
      cin>>vec[i];
  }
  for(int i=0;i<n;i++){
      cin>>vec2[i];
  }
  cout<<getMaxCount(vec,vec2);

  return 0;
}

Amazon Dublin โœ…
long ans = 0;
        for (int i = 0; i < arr.size(); i++)
        {
            map<int, int> m;
            for (int j = i; j < arr.size(); j++)
            {
                m[arr[j]]++;
            }
            ans += m.size();
        }
        return ans;

Amazon Dublin OAโœ