Minimum in a Rotated Sorted Array
Updated
Problem statement
An array values was originally sorted in strictly increasing order and then rotated at an unknown pivot. The array may also be unrotated.
Return its minimum value. Your algorithm should run in logarithmic time.
Function
findMinimum(values: int[]) → intExamples
Example 1
values = [3,4,5,1,2]return = 1The sorted order was rotated so that 1, the minimum, begins the final increasing segment.
Example 2
values = [4,5,6,7,0,1,2]return = 0The rotation pivot places 0 after 7.
Example 3
values = [11,13,15,17]return = 11The array is unrotated, so its first value is the minimum.
Constraints
1 <= values.length <= 10^5-2^31 <= values[i] <= 2^31 - 1- All values are distinct.
valuesis a rotation of a strictly increasing array.
More Goldman Sachs Onsite Interview questions
- Best Average Student ScorePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Knight Probability in ChessboardONSITE INTERVIEW · Seen Nov 2026
- Meeting RoomsPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Minimum Meeting Rooms Without a Sweep LineONSITE INTERVIEW · Seen Oct 2026
- First Non-Repeating CharacterPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Root of the Largest TreePHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Dungeon HealthONSITE INTERVIEW · Seen Sep 2026
- Insert, Delete, And Get Random In Constant TimeONSITE INTERVIEW · Seen Sep 2026
- Least Recently Used CacheONSITE INTERVIEW · Seen Sep 2026
- Staircase Search In A Sorted MatrixONSITE INTERVIEW · Seen Sep 2026
Similar questions at other companies
- Minimum Number of Days to Make m BouquetsPhonePe · ONSITE INTERVIEWPhonePe interview questions
- Single Element in a Sorted ArrayGreyOrange · PHONE SCREENGreyOrange interview questions
- Count Winning Dice Face PairsGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
- Search in a Rotated Sorted ArrayAmazon · PHONE SCREEN · ONSITE INTERVIEW
- Search a Row- and Column-Sorted MatrixByteDance · ONSITE INTERVIEWByteDance interview questions
- 3Sum SmallerSalesforce · ONSITE INTERVIEWSalesforce interview questions
- Koko Eating BananasThe D.E. Shaw Group · PHONE SCREENThe D.E. Shaw Group interview questions
- Smallest Batch Size Within a Step LimitMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
- Find First and Last Position in a Sorted ArrayInstacart · PHONE SCREENInstacart interview questions
- Peak of an Increasing-Then-Decreasing ArraySnap Inc. · ONSITE INTERVIEWSnap Inc. interview questions