๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.63K subscribers
5.6K photos
3 videos
95 files
10.3K 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;
const int MOD = 1000000007;
int countNewArrays(vector<int>& arr) {
    int n = arr.size();
        sort(arr.begin(), arr.end());
    long long result = 1;
    for (int i = 0; i < n; ++i) {
        int a = arr[i] - i;
                if (a <= 0) {
            return 0;
                }
        result = (result * possaible_values) % MOD;
    }
   
    return result;
}

DE SHAW โœ…
๐Ÿ‘1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
typedef struct {
    int a, b, c;
    double area;
} triangle;

double calculate_area(int a, int b, int c) {
    double p = (a + b + c) / 2.0;
    return (p * (p - a) * (p - b) * (p - c));
}

int compare(const void* a, const void* b) {
    triangle* t1 = (triangle*)a;
    triangle* t2 = (triangle*)b;
    if (t1->area < t2->area)
        return -1;
    else if (t1->area > t2->area)
        return 1;
    else
        return 0;
}

int sort_by_area(triangle* tr, int n) {

    if (tr == NULL || n <= 0) {
        return -1;
    }
        for (int i = 0; i < n; i++) {
        tr[i].area = calculate_area(tr[i].a, tr[i].b, tr[i].c);
    }
        qsort(tr, n, sizeof(triangle), compare);
   
    return 0;
}


IBMโœ…
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
public class Main {

    public static void convertToIpv6(String ipv4Address) {
        String[] octets = ipv4Address.split("\\.");
        if (octets.length != 4) {
            System.out.println("Invalid input");
            return;
        }

        if (octets[0].equals("127")) {
            System.out.println("::1");
            return;
        }

        StringBuilder ipv6 = new StringBuilder("::FFFF:");

        try {
            for (int i = 0; i < 4; i++) {
                int octet = Integer.parseInt(octets[i]);
                if (octet < 0 || octet > 255) {
                    System.out.println("Invalid input");
                    return;
                }
                String hex = String.format("%02X", octet);
                ipv6.append(hex);
                if (i == 1) {
                    ipv6.append(":");
                }
            }
        } catch (NumberFormatException e) {
            System.out.println("Invalid input");
            return;
        }

        System.out.println(ipv6.toString());
    }


IBMโœ…
def optimize_packaging(N, prods, M, bxs, K):
    prods.sort(key=lambda x: x[0], reverse=True)
    bxs.sort(key=lambda x: x[0], reverse=True)
   
    boxC = 0
    pidx = 0
   
    for bx in bxs:
        boxW, boxV = bx
        currW = 0
        currV = 0
       
        while (pidx < N and
               currW + prods[pidx][0] <= boxW and
               currV + prods[pidx][1] <= boxV):
            currW += prods[pidx][0]
            currV += prods[pidx][1]
            pidx += 1
       
        if currW > 0 or currV > 0:
            boxC += 1
       
        if pidx == N:
            break
   
    return boxC if pidx == N and boxC <= K else -1


Product Packaging
Meesho Dice โœ…
def last_animal_name_length(animal_sequence):
    print(animal_sequence)
    res = [an for an in animal_sequence.split('-') if an != '']
    l=res[-1]
    if(l=='|'):return 3
    return len(l)



IBMโœ…
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main() {
    fast();
    int N, M, K;
    cin >> N >> M; 

    unordered_map<int, int> freq;

    for (int i = 0; i < N; i++) {
        set<int> uniqP;
        for (int j = 0; j < M; j++) {
            int pid;
            cin >> pid;
            uniqP.insert(pid);
        }
        for (int prod : uniqP) {
            freq[prod]++;
        }
    }

    cin >> K; 

    vector<int> res; 
    for (auto& it : freq) {
        if (it.second >= K) {
            res.push_back(it.first);
        }
    }
    sort(res.begin(), res.end());

    for (int prod : res) {
        cout << prod << " ";
    }
    cout << endl;

}
๐Ÿ‘2
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
def parse_ip_header(a, b, c):
    def binary_to_decimal(binary_str):
        try:
            return int(binary_str, 2)
        except ValueError:
            print("Error converting binary to decimal. Invalid binary string.")
            return -1
    if len(a) < 32 or len(b) < 32 or len(c) < 32:
        print("INVALID Input")
        return
    version = binary_to_decimal(a[0:4])
    protocol_binary = a[4:12]
    ttl_binary = a[12:20]
    packet_length_binary = a[20:32]
    protocol_number = binary_to_decimal(protocol_binary)
    protocol = 'TCP' if protocol_number == 6 else 'UDP' if protocol_number == 17 else 'Unknown'
    ttl = binary_to_decimal(ttl_binary)
    packet_length = binary_to_decimal(packet_length_binary)
   
    def binary_ip_to_decimal(ip_binary):
        try:
            return '.'.join(str(binary_to_decimal(ip_binary[i:i+8])) for i in range(0, 32, 8))
        except ValueError:
            print("Error converting binary IP to decimal.")
            return "Invalid IP"
    source_ip = binary_ip_to_decimal(b)
    destination_ip = binary_ip_to_decimal(c)
    print(f"{version},{protocol},{ttl},{packet_length}")
    print(source_ip)
    print(destination_ip)

import sys

n = int(input())
inputs = [line.strip() for line in sys.stdin.readlines()]

if len(inputs) < 3:
    print("Invalid Input")
else:
    a, b, c = inputs[:3]
    parse_ip_header(a, b, c)


IBMโœ…
#include <iostream>
#include <string>
using namespace std;

string outputNumber(string inputStr) {
    string result = "";
    int count = 1;
   
    for (size_t i = 1; i < inputStr.length(); ++i) {
        if (inputStr[i] == inputStr[i - 1]) {
            count++;
        } else {
            result += to_string(count);
            count = 1;
        }
    }
    result += to_string(count); // Append the count of the last sequence
   
    return result;
}

int main() {
    string inputStr;
    getline(cin, inputStr);
   
    cout << outputNumber(inputStr) << endl;
   
    return 0;
}

Principal FTE โœ…
#include <bits/stdc++.h>
using namespace std;

unsigned int single_digit_sum(int num) {
    while (num >= 10) {
        int sum = 0;
        while (num > 0) {
            sum += num % 10;
            num /= 10;
        }
        num = sum;
    }
    return num;
}

unsigned int quotient(int** a, int n, int p, int q) {
    unsigned int diagonal_sum = 0;
    for (int i = 0; i < n; ++i) {
        diagonal_sum += a[i][i];
    }
   
    unsigned int single_digit = single_digit_sum(a[p][q]);
   
    return diagonal_sum / single_digit;
}

int main() {
    int i, j, p, q;
    int n;
    cin >> n;
   
    int** a = new int*[n];
    for (i = 0; i < n; ++i) {
        a[i] = new int[n];
    }
   
    for (i = 0; i < n; ++i) {
        for (j = 0; j < n; ++j) {
            cin >> a[i][j];
        }
    }
   
    cin >> p >> q;
   
    cout << quotient(a, n, p, q);
   
    for (i = 0; i < n; ++i) {
        delete[] a[i];
    }
    delete[] a;
   
    return 0;
}

Principal FTE โœ…
๐Ÿ‘1
int Max (int N, int K, vector<int> arr) {
   vector<int> b(N + 1, 0);
    vector<int> c;
    int cnt = 0;
    for (int i = 1; i <= N; ++i) {
        if (arr[i - 1] % 2 == 1) {
            b[i] = 1;
        } else {
            b[i] = -1;
        }
    }
    for (int i = 1; i <= N; ++i) {
        b[i] += b[i - 1];
    }
    for (int i = 1; i < N; ++i) {
        if (b[i] == 0) {
            c.push_back(abs(arr[i] - arr[i - 1]));
        }
    }
    sort(c.begin(), c.end());
    int pt = 0, cost = 0;

    while (pt < c.size() && cost + c[pt] <= K) {
        cost += c[pt];
        ++pt;
    }

    return pt;
}

max separations
โœ…
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1000000;
vector<long long> dp(MAXN + 1, 0);
void precompute() {
    dp[1] = 1;
    for (int i = 1; i <= MAXN; i++) {
        for (int j = 2 * i; j <= MAXN; j += i) {
            dp[j] += dp[i];
        }
    }
}

class Precompute {
public:
    Precompute() {
        precompute();
    }
};
Precompute pre;

long long solve(int N) {
    return dp[N];
}


Islands
BT Group โœ…
#include <iostream>
#include <vector>
using namespace std;
long long sumDifferentParity(int N, const vector<int>& A) {
    long long sum = 0;
    for (int i = 1; i <= N; ++i) {
        int value = A[i - 1];
        if ((i % 2) != (value % 2)) {
            sum += value;
        }
    }

    return sum;
}

correct pair sumโœ…
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
long long findMaxRequests(int N, vector<int>& A, vector<int>& L, vector<int>& R) {
    map<int, long long> events;
    for (int i = 0; i < N; i++) {
        events[L[i]] += A[i];     
        events[R[i]] -= A[i];      
    }
    long long c = 0;
    long long m = 0;
    for (auto& event : events) {
        c += event.second;
        m = max(m, c);
    }
    return m;
}


Server Capability โœ…
https://www.linkedin.com/posts/bhavana-bhavana-5b024a188_greeting-from-quess-corp-we-are-hiring-for-activity-7238787314640900096-xfph?utm_source=share&utm_medium=member_desktop

Greeting from Quess corp
We are hiring for one of our reputed client for Desktop management

Fresher only 2022, 2023 and 2024 batch
WFO /WFH โ€“ WFO
Work Timings โ€“ 6:30 PM โ€“ 4 AM IST Both the way cab will be provided
Work Location โ€“ Bangalore
CTC - 21900 Monthly

Job Description โ€“ Desktop Support Management.
Summary: As an Application Support Engineer, you will be responsible for identifying and solving issues within multiple components of critical business systems. Your typical day will involve providing support for Microsoft Windows Desktop Management and ensuring smooth functioning of the systems
๐Ÿ‘1