LearnPy Hub
← Recursion & Lambda problems
Medium

Recursive Binary Search

Write a recursive find(a, x, lo, hi) that returns the index of x in the sorted list a, or -1. Read the list and x and print the result.

Input

Two lines.

Output

One integer.

Sample 1

Input
1 3 5 7 9
7
Output
3

Sample 2

Input
1 3 5
4
Output
-1
solution.py
Output appears here
Recursive Binary Search · Python practice problem · LearnPy Hub