๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.63K subscribers
5.59K photos
3 videos
95 files
10.2K 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
Zopsmart is hiring!
We are inviting campus placement cells to participate in ZopSmart Campus Hiring (1 Year internship plus FTE) for a batch of 2025 (should be able to join from the 1st week of October 2024).
Please reach out to
padmavathi.s@zopsmart.com & vinayak.sattigeri@zopsmart.com
Location - Bangalore HSR Layout
def solve(start, stop):
    def ss(num):
        num_str = str(num)
        for char in num_str:
            digit = int(char)
            if digit == 0 or num % digit != 0:
                return False
        return True
    total_sum = 0
    for num in range(start, stop + 1):
        if ss(num):
            total_sum += num
    return total_sum


Motorq โœ…
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
using namespace std;
long long minTimeToEvent(int x, int z, int m, const vector<int>& friends) {
    long long minTime = LLONG_MAX;

    for (int Y : friends) {
        long long time = abs(x - Y) + m + abs(Y - z);
        minTime = min(minTime, time);
    }

    return minTime;
}


Motorq โœ…
๐Ÿ‘1
#include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
int maxValidLength(const vector<int>& flowers, int K) {
    unordered_map<int, int> count;
    int n = flowers.size();
    int maxLength = 0;
    int left = 0;
    int distinctCount = 0;

    for (int right = 0; right < n; ++right) {
        if (count[flowers[right]] == 0) {
            distinctCount++;
        }
        count[flowers[right]]++;
                while (distinctCount == K) {
            count[flowers[left]]--;
            if (count[flowers[left]] == 0) {
                distinctCount--;
            }
            left++;
        }
       
        maxLength = max(maxLength, right - left + 1);
    }
   
    return maxLength;
}


Gardener and the flowers โœ…
Motorq
๐Ÿ‘1
SELECT
    department_id AS department_id,
    ROUND(AVG(salary), 2) AS avg_salary,
    COUNT(employee_id) AS num_employees
FROM
    employees
GROUP BY
    department_id
ORDER BY
    avg_salary DESC,
    department_id ASC;

Motorq โœ…
๐Ÿ‘1
void generateSubsequences(string s, string current, vector<string>& subsequences) {
    if (s.empty()) {
        if (!current.empty()) {
            subsequences.push_back(current);
        }
        return;
    }
   
    generateSubsequences(s.substr(1), current + s[0], subsequences);
    generateSubsequences(s.substr(1), current, subsequences);
}

vector<string> buildSubsequences(string s) {
    vector<string> subsequences;
    generateSubsequences(s, "", subsequences);
    sort(subsequences.begin(), subsequences.end());
    return subsequences;
}

Build the subsequence
ORACLEโœ…
from itertools import product
def goodOrBad(statementCounts, statements):
    n = len(statementCounts)
    max_good = 0
    for combination in product([True, False], repeat=n):
        is_valid = True
        good_count = sum(combination)
        for person, statement in statements:
            person -= 1
            if combination[person]:
                if not combination[statement - 1] == (statement == 1): 
                    is_valid = False
                    break
       
        if is_valid:
            max_good = max(max_good, good_count)
    return max_good


GOOD OR BADโœ…
Oracle
๐Ÿคฉ2