๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.58K subscribers
5.59K photos
3 videos
95 files
10.1K 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 cardinalitySort(nums):     return sorted(nums, key=lambda num: [bin(num).count('1'), num]) Cardinality sorting JP Morgan โœ…
#include <bits/stdc++.h>
using namespace std;
bool checkbit(int n,int i){
    return n&(1<<i);
}
bool cmp(const pair<int,int> &a,const pair<int,int>&b){
    return a.second<b.second;
}
int main() {
  // your code goes here
  int n;cin>>n;
  int a[n];
  for(int i=0;i<n;i++) cin>>a[i];
  vector<pair<int,int>> v;
  for(int i=0;i<n;i++){
      int c=0;
      for(int j=0;j<31;j++){
          if(checkbit(a[i],j)) c++;
      }
      v.push_back({a[i],c});
  }
  int idx = 0;
  sort(v.begin(),v.end(),cmp);
  for(auto it : v){
      a[idx++] = it.first;
      cout<<it.second<<" ";
  }
  for(int i=0;i<n;i++){
      cout<<a[i]<<" ";
  }
  return 0;
}

C++โœ…
def buildTree(inorder, preorder):
    if not inorder or not preorder:
        return []

    rval = preorder.pop(0)
    idx = inorder.index(rval)

    lin = inorder[:idx]
    rin = inorder[idx + 1:]

    l_pr = [val for val in preorder if val in lin]
    r_pr = [val for val in preorder if val in rin]

    root = [rval, buildTree(lin, l_pr), buildTree(rin, r_pr)]

    return root

def postorderTraversal(root):
    if not root:
        return []

    result = []

    result += postorderTraversal(root[1])
    result += postorderTraversal(root[2])
    result.append(root[0])

    return result

def Fin_PostOrder(cls ,input1, input2, input3):
    if input1 == 0:
        return []

    root = buildTree(input2, input3)
    postorder = postorderTraversal(root)

    return postorder

Tata mgโœ…
Python 3
Find the postorder transversal
function findSubsequence(arr)
{
    var a = [-1];
    var list = [];
    const letters = new Set();
    let maxInteger = 0;
    for (let i = 0; i < = arr.length - 1; i++)
    {
        if (letters.has(arr[i]))
        {
            if (maxInteger <= arr[i])
            {
                maxInteger = arr[i];
                list.push(arr[i]);
            }
            else
            {
                return a;
            }
        }
        else
        {
            letters.add(arr[i]);
        }
    }
    return list;
}

Subsequence Removalโœ…
Zscaler
int bits(int a)
{
  int z=0;
  while(a)
  {
    z=z+(a%2);
    a=a/2;
  }
  return z;
}
long count(vector<int>a,int k)
{
  int i=0;
  long z=0;
  vector<int>u;
  for(int i=0;i<a.size();i++)
  {
    u.push_back(bits(a[i]));
  }
  int j=u.size()-1;
  while(j>i)
  {
    if(k>u[i]+u[j])
    {
      i++;
    }
    else
    {
      z=z+((long long)j-i);
      j--;
    }
  }
  return z;
}

Bits in Archie โœ…
Zscaler
๐Ÿ‘1
vector<int> par, sz;

int find(int u){
    if(u==par[u])
        return u;
    return par[u] = find(par[u]);
}

void dsu(int a, int b){
    a = find(a);
    b = find(b);
   
    if(a!=b){
        if(sz[a]<sz[b])
            swap(a, b);
       
        sz[a] += sz[b];
        par[b] = a;
    }
}

vector<int> getVisibleProfilesCount(int connection_nodes, vector<int> conncection_from, vector<int> connection_to, vector<int> queries){
    par = vector<int>(connection_nodes+1);
    sz = vector<int>(connection_nodes+1, 1);
   
    for(int i=1;i<=connection_nodes;i++){
        par[i]=i;
    }
   
    for(int i=0;i<conncection_from.size();i++){
        find(i);
    }
   
    vector<int> ans(queries.size());
    for(int i=0;i<queries.size();i++){
        ans[i]=sz[par[queries[i]]];
    }
    return ans;
}

Social Connection โœ…
Zscaler
Wenger & Watson is hiring MBA freshers

Education : MBA(HR)
Role : Management Trainee
Passing year : 2021, 2022 and 2023 batch
Location : Bangalore

โ€ข Excellent Communication
โ€ข Immediate joiner

Interested candidates can send their resumes to hannan.sameed@wengerwatson.com