⌘K
Flycodx

Newspaper Delivery Zone Identifier

Newspaper Delivery Zone Identifier

MediumBinary Search100% accepted

Arjun is a newspaper delivery boy in Mumbai who needs to find his assigned delivery zone based on house numbers. The zones are defined by ranges of house numbers.

Approach

Given an array of zone boundary house numbers and a target house number, find the zone index.

Input

zones=[100, 250, 400, 550, 700], house=350

Output

2
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