Loading...
Loading...
Loading...
A sorted list holds stock levels with repeats. For a level x print its first and last position (counting from 0), or -1 -1 if x is not in the list.
Example 1
Input
6 5 10 10 10 20 30 10
Output
1 3
Example 2
Input
6 5 10 10 10 20 30 15
Output
-1 -1
Try the problem first. Open one hint at a time.
The first position is the lower bound of x, if the item there equals x.
The last position is the upper bound minus one.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor