๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
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
int maxLcmOfPairs(int arr[], int n){ 
  int maxLCM = -1;

  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {

      maxLCM  = max(maxLCM, (arr[i] * arr[j]) / __gcd(arr[i], arr[j]));
    }
  }

  return maxLCM;
}

Pair problem โœ…
class UserMainCode(object):
    @classmethod
    def reduceTheBill(cls, input1):
        binary_input = bin(input1)[2:]
        res = []
        for i in range(len(binary_input)):
            flipped_bit = '1' if binary_input[i] == '0' else '0'
            flipped_binary = binary_input[:i] + flipped_bit + binary_input[i+1:]
            res.append(int(flipped_binary, 2))
        return min(res)

Reduce the Bill โœ…
public static int countBountyNumbers(int N) {
        int MOD = 10007;

        long totalNDigitNumbers = 9 * (long) Math.pow(10, N - 1);
        long noZeros = (long) Math.pow(9, N);
        long oneZero = (N - 1) * 9 * (long) Math.pow(9, N - 2);
        long validNumbers = (totalNDigitNumbers - noZeros - oneZero) % MOD;

        if (validNumbers < 0) {
            validNumbers += MOD;
        }

        return (int) validNumbers;
    }

Bounty โœ…
def lineUp(commands):
    size = len(commands)
    deg = 0
    temp = 0
    for i in range(0,size):
        if commands[i] == 'L':
            deg += -90
        elif commands[i] == 'R':
            deg += 90
        elif commands[i] == 'A':
            deg += 180
        if deg%180==0:
            temp += 1
            deg = 0
    return temp
#include <iostream>
#include <vector>
using namespace std;
int andyTrucker(int N, int K, vector<int>& A) {
    int maxWeight = 0;
    for (int i = 0; i <= N - K; ++i) {
        int currentWeight = 0;
        for (int j = i; j < i + K; ++j) {
            currentWeight += A[j];
        }
        maxWeight = max(maxWeight, currentWeight);
    }

    return maxWeight;
}
#include <bits/stdc++.h>
using namespace std;
vector<int> distinctOrder(int g_nodes, vector<int> g_from, vector<int> g_to) {
    vector<vector<int>> adj(g_nodes + 1);
    for (int i = 0; i < g_from.size(); ++i)
    {
        adj[g_from[i]].push_back(g_to[i]);
        adj[g_to[i]].push_back(g_from[i]);
    }

    for (int i = 1; i <= g_nodes; ++i)
    {
        sort(adj[i].rbegin(), adj[i].rend());
    }

    vector<int> A;
    vector<bool> visited(g_nodes + 1, false);
    priority_queue<int> pq;
    pq.push(g_nodes); 

    while (!pq.empty())
    {
        int node = pq.top();
        pq.pop();

        if (visited[node]) continue;
        visited[node] = true;
        A.push_back(node);

        for (int neighbor : adj[node])
        {
            if (!visited[neighbor])
            {
                pq.push(neighbor);
            }
        }
    }

    return A;
}

Distinct order Traversal โœ