๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.59K 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
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
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
import java.util.Scanner;

public class Solution {

    public static int countSundays(int startYear, int endYear) {
        int answer = 0;
        int day = 1;

        for (int year = 1900; year < startYear; year++) {
            for (int month = 1; month <= 12; month++) {
                day = (day + daysInMonth(month, year)) % 7;
            }
        }

        for (int year = startYear; year <= endYear; year++) {
            for (int month = 1; month <= 12; month++) {
                if (day == 0) {
                    answer++;
                }
                day = (day + daysInMonth(month, year)) % 7;
            }
        }

        return answer;
    }

    private static int daysInMonth(int month, int year) {
        switch (month) {
            case 4:
            case 6:
            case 9:
            case 11:
                return 30;
            case 2:
                if (isLeapYear(year)) {
                    return 29;
                } else {
                    return 28;
                }
            default:
                return 31;
        }
    }

    private static boolean isLeapYear(int year) {
        if (year % 4 != 0) {
            return false;
        } else if (year % 100 != 0) {
            return true;
        } else if (year % 400 != 0) {
            return false;
        } else {
            return true;
        }
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        int startYear = in.nextInt();
        int endYear = in.nextInt();

        int result = countSundays(startYear, endYear);
        System.out.print(result);
    }
}

Well fargo |javaโœ…
Scanner scanner = new Scanner(System.in);
        int numOfProducts = scanner.nextInt();
        int[] orders = new int[numOfProducts];

        for (int i = 0; i < numOfProducts; i++) {
            orders[i] = Math.abs(scanner.nextInt());
        }

        int disAmount = scanner.nextInt();
        int count = 0;

        for (int order : orders) {
            if (disAmount % order == 0) {
                count++;
            }
        }

        System.out.println(count);  

Wells Fargo Javaโœ…
๐Ÿ‘1