Find Song by Play Count Threshold
Find Song by Play Count Threshold
MediumBinary Search0% accepted
Meera curates a JioSaavn playlist. She needs to find the most played song that hasn't crossed a certain viral threshold for recommendations.
Approach
Given sorted song play counts and a maximum threshold, find the highest play count that doesn't exceed the threshold.
Input
5
100 500 1200 2500 5000
2000
Output
2
More Binary Search problems
Browse all coding problems →solution.py
Loading editor...
Test 1
Test 2
Test 3
Press Run to test your custom input, or Submit to judge against all test cases.
Sign in to continue
Create a free account to run code, submit solutions and track progress.
- Free forever — no credit card
- 10+ languages with live execution
- Points, streaks & leaderboards