You are given a rotated array of unique integers, originally sorted in ascending order.
Your task is to find the largest element in the array.
You may assume that:
array contains no duplicate elements.Return the largest element found.
[4, 5, 6, 7, 0, 1, 2]
7
The array is [4, 5, 6, 7, 0, 1, 2]. The largest element is 7.
[11, 13, 15, 17]
17
The array is [11, 13, 15, 17]. This is equivalent to an array rotated 0 times. The largest element is 17.
[5, 1, 2, 3, 4]
5
The array is [5, 1, 2, 3, 4]. The largest element is 5.
[4, 5, 6, 7, 0, 1, 2]
7