Diwali Festival Date Search
Diwali Festival Date Search
MediumBinary Search100% accepted
Arjun is planning his Diwali celebration and needs to find which year Diwali falls on a specific date from his calendar list.
Approach
Given an array of [year, diwali_date] pairs sorted by year, find the first year when Diwali occurs on the target date.
Input
years=[[2020,'Nov 14'],[2021,'Nov 4'],[2022,'Oct 24'],[2023,'Nov 12'],[2024,'Nov 1']], target='Nov 1'
Output
4
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