Problem
Input format
The first line contains `n` and `x`, separated by a space. The second line contains the `n` elements of the array, separated by spaces, in strictly ascending order. - `1 <= n <= 50` - Array elements are integers with absolute value at most `1.000.000.000`, strictly ascending. - The solution must use recursion.
Output format
The program prints the position of `x` (from 1 to `n`) or `-1` if not present, followed by a newline.
Example
6 7 1 3 5 7 9 11
4
Stuck?
Use the Get Hint button in the action bar to reveal a guided hint.
💬 Discussion
Loading...No comments yet. Be the first to start the discussion!
Sample cases (from the problem)
Sample Case 1
6 7 1 3 5 7 9 11
4
Solve it your way first
Community solutions unlock after you submit a passing solution. Don't peek.
Ready to solve this challenge?
Create a free account to write code, submit solutions, and track your progress.