⌘K
Flycodx

Dabba Tiffin Delivery Stop Finder

Dabba Tiffin Delivery Stop Finder

MediumBinary Search100% accepted

Meera orders a home-cooked dabba from a tiffin service in Delhi and needs to find which delivery stop serves her office area. The service has multiple stops arranged in a sorted order by distance.

Approach

Given an array of delivery stops with distances and target distance, find the stop index serving that distance range.

Input

stops=[2, 5, 8, 12, 15], target=9

Output

3
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
Auto Save OnLn 1, Col 1Spaces: 4UTF-8LFPython 3