Skip to content
We areTOP 1%

Interesting drink

EasyRating 1100CodeforcesBinary Search
Solve on Codeforces(opens in a new tab)
Track your progress
First attempt
Re-solve after a few days
Final pass before interviews
Approach hintTry it first, then reveal

Sort the prices once; for each day the answer is the number of prices not exceeding the budget, which upper_bound returns in O(log n).

More in Binary Search

Binary Search questions
#ProblemPlatformDifficultyOpen1st1st Visit2nd2nd VisitRevRevise
1Binary SearchLeetCodeEasy Solve Binary Search on LeetCode (opens in a new tab)
2Search Insert PositionLeetCodeEasy Solve Search Insert Position on LeetCode (opens in a new tab)
3First Bad VersionLeetCodeEasy Solve First Bad Version on LeetCode (opens in a new tab)
4LettersCodeforcesEasy 1000Solve Letters on Codeforces (opens in a new tab)
5Interesting drinkCodeforcesEasy 1100Solve Interesting drink on Codeforces (opens in a new tab)
6Eating QueriesCodeforcesEasy 1100Solve Eating Queries on Codeforces (opens in a new tab)
7Sum of CubesCodeforcesEasy 1100Solve Sum of Cubes on Codeforces (opens in a new tab)
8WormsCodeforcesEasy 1200Solve Worms on Codeforces (opens in a new tab)
9Find First and Last Position of Element in Sorted ArrayLeetCodeMedium Solve Find First and Last Position of Element in Sorted Array on LeetCode (opens in a new tab)
10Find Minimum in Rotated Sorted ArrayLeetCodeMedium Solve Find Minimum in Rotated Sorted Array on LeetCode (opens in a new tab)
11Search in Rotated Sorted ArrayLeetCodeMedium Solve Search in Rotated Sorted Array on LeetCode (opens in a new tab)
12Find Peak ElementLeetCodeMedium Solve Find Peak Element on LeetCode (opens in a new tab)

Sign in to track your progress

Your checkboxes, streak and activity heatmap are saved to your account and sync across devices. It is free.
Sign in with email

New here? Create an account