๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
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
from collections import deque
def timeOfBuffering(arrivalRate, packets):
    buffer = deque()
    current = 1
    time = 0

    for i in range(0, len(packets), arrivalRate):
        time += 1

        for j in range(i, min(i + arrivalRate, len(packets))):
            packet = packets[j]
            if packet != current:
                buffer.append(packet)

        if current in buffer:
            buffer.remove(current)
        elif current == packets[i]:
            pass
        else:
            return time

        current += 1

    return -1


Video Buffering โœ…
๐Ÿ‘2
def maxProfit(cost, x):
    ans = 0
    mod = 10 ** 9 + 7
    for i in range(len(cost) - 1, -1, -1):
        if cost[i] <= x:
            x -= cost[i]
            ans = (ans + pow(2, i, mod)) % mod
    return ans