Day 85 of 100 days dsa coding challenge

Published: (December 27, 2025 at 11:59 PM EST)
1 min read
Source: Dev.to

Source: Dev.to

Challenge Overview

Taking on a new challenge: solving GeeksforGeeks POTD daily and sharing my solutions! ๐Ÿ’ป๐Ÿ”ฅ

Problem

Minimum time to fulfil all orders
GeeksforGeeks โ€“ Minimum time to fulfil all orders

Difficulty: Hardโ€ƒAccuracy: 66.7%

Geek is organizing a party at his house. For the party, he needs exactly n donuts for the guests. Geek decides to order the donuts from a nearby restaurant, which has m chefs and each chef has a rank r.

Solution Approach

The problem can be solved using binary search on the answer (time). For a given time mid, we compute how many donuts each chef can make and sum them up. If the total is at least n, we try a smaller time; otherwise, we increase the time.

def minimum_time(ranks, n):
    # Helper to compute donuts a chef with rank r can make in given time t
    def donuts_made(r, t):
        # Solve r * k * (k + 1) / 2 = n:
                break
        if total >= n:
            high = mid
        else:
            low = mid + 1
    return low

The function minimum_time returns the smallest time required for the chefs to produce at least n donuts.

Back to Blog

Related posts

Read more ยป

Day 84 of 100 days dsa coding challenge

Problem GeeksforGeeks โ€“ Kth smallest element in a Matrixhttps://www.geeksforgeeks.org/problems/kth-element-in-matrix/1 Difficulty: Medium | Accuracy: 61.42% Gi...

Day 78 of 100 days dsa coding challenge

Taking on a new challenge: solving GeeksforGeeks POTD daily and sharing my solutions! ๐Ÿ’ป๐Ÿ”ฅ The goal: sharpen problemโ€‘solving skills, level up coding, and learn...

Day 76 of 100 days dsa coding challenge

Problem Bus Conductor โ€“ GeeksforGeekshttps://www.geeksforgeeks.org/problems/bus-conductor--170647/1 Difficulty: Easy Accuracy: 75.3% Examples Example 1 - Input...