FastPrepMinimum in a Rotated Sorted Array
Problems/Minimum in a Rotated Sorted Array

Minimum in a Rotated Sorted Array

Mygate logoMygate● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Mygate phone screen for a full-time role. The report asks for the minimum of a rotated sorted array in logarithmic time and constant space. It does not say whether values can repeat or give limits. Here the values are distinct, so that target holds.

Our version is about 95% the same as the reported question.

Given a nonempty array nums formed by rotating a strictly increasing integer array, return its minimum element.

Rotating moves a prefix to the end while preserving the order within each part. Zero rotations are allowed. All elements are distinct.

Your solution must use O(log n) time and O(1) extra space.

Function

minimumRotatedArray(nums: int[]) → int

Examples

Example 1

nums = [3,4,5,1,2]return = 1

The increasing sequence [1, 2, 3, 4, 5] was rotated, and its minimum remains 1.

Example 2

nums = [1,2,3]return = 1

A zero rotation is valid; the first value is the minimum.

Example 3

nums = [5]return = 5

A singleton has no different minimum.

Constraints

  • 1 <= nums.length <= 10^5
  • -10^9 <= nums[i] <= 10^9
  • All values are distinct, and nums is a rotation of a strictly increasing array.

More Mygate Phone Screen questions

  • Employees Earning More Than Their ManagerPHONE SCREEN · Seen Sep 2026
  • Maximum Subarray SumPHONE SCREEN · Seen Sep 2026
  • Reverse a Linked ListPHONE SCREEN · Seen Sep 2026
  • Users Active in Both January and FebruaryPHONE SCREEN · Seen Sep 2026
  • Elements Occurring More Than n/3 TimesPHONE SCREEN · Seen Jan 2025
  • Frog Jump: Minimum EnergyPHONE SCREEN · Seen Jan 2025
  • Left View of a Binary TreePHONE SCREEN · Seen Jan 2025
  • Two SumPHONE SCREEN · Seen Aug 2024
  • Minimum Subarray SumPHONE SCREEN · Seen Sep 2023
  • Remove the Nth Node from the EndPHONE SCREEN · Seen Sep 2023

Similar questions at other companies

  • Longest Increasing SubsequenceByteDance · PHONE SCREENByteDance interview questions
  • Koko Eating BananasThe D.E. Shaw Group · PHONE SCREENThe D.E. Shaw Group interview questions
  • Find First and Last Position in a Sorted ArrayInstacart · PHONE SCREENInstacart interview questions
  • Random Pick with Weight Using Recorded DrawsGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Longest Increasing SubsequenceAngel One · PHONE SCREEN
  • Aggressive CowsAmazon · PHONE SCREEN
  • Search a 2D MatrixWhatNot · PHONE SCREEN · ONSITE INTERVIEWWhatNot interview questions
  • Find First and Last Position of Element in Sorted ArrayEPAM · PHONE SCREENEPAM interview questions
  • Find K Closest Elements in a Sorted ArrayNavi · PHONE SCREEN
  • Search in Rotated Sorted ArrayZoomInfo · PHONE SCREEN
All Mygate interview questionsSee Mygate hiring insights
Saved
class Solution {
    public int minimumRotatedArray(int[] nums) {
        // write your code here
    }
}
Checking account…