๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.63K subscribers
5.61K photos
3 videos
95 files
10.6K 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>
#include <algorithm>
using namespace std;

int getMinimumTime(vector<int>& processSize, vector<int>& capacity) {
    sort(processSize.rbegin(), processSize.rend());
    sort(capacity.rbegin(), capacity.rend());
   
    int ptr = 0;
    int time = 1;
   
    for (int process : processSize) {
        if (ptr == capacity.size()) {
            time++;
            ptr = 0;
        }
        if (process > capacity[ptr]) {
        
            if (process > capacity[0]) {
                return -1;
            }
            time++;
            ptr = 1;
        } else {
            ptr++;
        }
    }
    return 2*time-1;
}

Process Allocation โœ…
๐Ÿ‘1
def min_total_marks(num_questions, marks):
    marks.sort()
   
    total_marks = marks[0]
   
    for i in range(1, num_questions):
        if marks[i] <= marks[i - 1]:
            marks[i] = marks[i - 1] + 1
        total_marks += marks[i]
   
    return total_marks

Mr. Myers and the Exam โœ…
๐Ÿ‘1
BharatX  hiring summer interns! ๐Ÿ’ฅ

We are a team of young, ambitious, and bold people love to dedicate their lifeโ€™s work towards something meaningful for India & the world. We love to have a shit ton of fun and cut the bullshit corporate culture! Here is your opportunity to build products that impact credit accessibility of 50M+ users. Apply below!!


Internship Details:
3-6 months
Final year of college
Onsite internship in Bangalore

What We Offer:
Stipend: 50k/month
PPO based on performance

How to Apply:
Fill out the form
๐Ÿ‘‰data science intern -
https://lnkd.in/g4qTQbQ6
๐Ÿ‘‰frontend intern -
https://lnkd.in/gdCtAH4M
import java.util.Arrays;

public class Main {

    static int findNumOfPairs(int[] a, int[] b) {
        Arrays.sort(a);
        Arrays.sort(b);

        int i = a.length -1 ;
        int j = b.length - 1;
        int pairs = 0;

        while (i >= 0 && j >= 0) {
            if (a[i] > b[j]) {
                pairs++;
                i--;
                j--;
            } else {
                j--;
            }
        }

        return pairs;
    }

Pairs โœ…
๐Ÿ‘1
def count_vowels(string):
    count = 0
    vowels = set('aeiou')
    for char in string:
        if char.lower() in vowels:
            count += 1
    return count

def determine_winner(strings):
    winners = []
    for string in strings:
        if count_vowels(string) % 2 == 0:
            winners.append("Chris")
        else:
            winners.append("Alex")
    return winners

System and Strings โœ…
๐Ÿ‘Ž5๐Ÿ‘1
int reachNumber(int target) {
    const int newTarget = abs(target);
    int ans = 0;
    int pos = 0;

    while (pos < newTarget)
      pos += ++ans;
    while ((pos - newTarget) & 1)
      pos += ++ans;

    return pos;
}

pos return karo instead of ans

Cross Number Puzzle โœ…
def min_remaining_length(seq):
    stack = []
    for char in seq:
        if char == "A" or char == "B":
            if stack and stack[-1] == "A" and char == "B":
                stack.pop()
            elif stack and stack[-1] == "B" and char == "B":
                stack.pop()
            else:
                stack.append(char)
        else:
            stack.append(char)
   
    return len(stack)

Substring Removal โœ…
JPMC code for good
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
import java.util.*;

public class Main {
    public static String getLargestNumber(String num) {
        StringBuilder ans = new StringBuilder();
        StringBuilder s = new StringBuilder();
       
        for (int i = 0; i < num.length() - 1; i++) {
            if ((num.charAt(i) - '0') % 2 == (num.charAt(i + 1) - '0') % 2) {
                s.append(num.charAt(i));
            } else {
                s.append(num.charAt(i));
                char[] chars = s.toString().toCharArray();
                Arrays.sort(chars);
                ans.append(new StringBuilder(new String(chars)).reverse());
                s.setLength(0);
            }
        }
       
        s.append(num.charAt(num.length() - 1));
        char[] chars = s.toString().toCharArray();
        Arrays.sort(chars);
        ans.append(new StringBuilder(new String(chars)).reverse());
       
        return ans.toString();
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        scanner.close();
        System.out.println(getLargestNumber(s));
    }
}

Swap Parity โœ…
JPMC code for good
๐Ÿ‘1