Marks :10
: 1 | : 0
Suppose an array of length $$$n$$$ sorted in ascending order is rotated between $$$1$$$ and $$$n$$$ times.
Notice that rotating an array $$$[a[0], a[1], a[2], ..., a[n-1]]$$$ $$$1$$$ time results in the array $$$[a[n-1], a[0], a[1], a[2], ..., a[n-2]].$$$
Given the sorted rotated array nums of unique elements, return this array's minimum and maximum elements.
You must write an algorithm that runs in $$$O(log$$$ $$$n)$$$ time.
The first line contains the integer $$$n$$$ $$$(1 \le n \le 10^{5} )$$$, denoting the size of the input array.
The second line contains an array of N integers, $$$a_1,a_2...a_n$$$, $$$(-10^{9} \le a_i \le 10^{9} )$$$ in sorted rotated way.
Return two integers, the minimum, and maximum element in the array.
5 4 5 1 2 3
1 5
5 1 1 1 1 1
1 1
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.