LearnPy Hub
← Arena
AdvancedRating 1500

Search a Rotated Array

A sorted array of distinct values was rotated. Print the index of x or -1, in O(log n).

Input

n x, then n integers.

Output

An index.

Sample 1

Input
7 0
4 5 6 7 0 1 2
Output
4

Sample 2

Input
7 3
4 5 6 7 0 1 2
Output
-1
solution.py
Output appears here
Search a Rotated Array · Python Arena problem · LearnPy Hub