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

Minimum in a Rotated Sorted Array

Expedia logoExpedia● MediumINTERNONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: An Expedia SWE intern review from Gurgaon, India, dated September 2024, names this classic among its questions: return the smallest value of a sorted array after it has been rotated. It does not say which round asked it. The candidate's process had a coding test and then a two-hour interview on data structures and algorithms, and we place the question in that interview.

No examples or limits are given. Here, all values are different, and the array was in increasing order before the rotation. It may not be rotated at all. It holds 1 to 10^4 values from -10^9 to 10^9. The editorial shows the O(log n) binary search that interviewers usually expect, but the tests also accept a simple scan.

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

An array of different integers was sorted in increasing order and then rotated: some values were taken off the end and put, in the same order, at the front. For example, [10,20,30,40,50] rotated by 2 becomes [40,50,10,20,30]. The array may also not be rotated at all.

You are given the rotated array nums. Return its smallest value.

Function

findMin(nums: int[]) → int

Examples

Example 1

nums = [30,40,50,10,20]return = 10

The array was [10,20,30,40,50] before it was rotated. The values climb from 30 to 50, then drop to 10. The value right after the drop is the smallest one, 10.

Example 2

nums = [-5,-2,3,8]return = -5

This array was not rotated at all, so it is still in increasing order and the smallest value is the first one, -5.

Example 3

nums = [6,9,12,-4]return = -4

The smallest value, -4, ended up in the last position.

Constraints

  • 1 <= nums.length <= 10^4
  • -10^9 <= nums[i] <= 10^9
  • All values in nums are different, and nums is an increasing array rotated some number of times (possibly zero).

More Expedia Onsite Interview questions

  • Scramble StringONSITE INTERVIEW · Seen Sep 2026
  • Smallest Sufficient TeamONSITE INTERVIEW · Seen Sep 2026
  • Check Anagram Pairs Index by IndexONSITE INTERVIEW · Seen Oct 2025
  • Fresh Oranges Left After Rotting StopsONSITE INTERVIEW · Seen Oct 2025
  • Longest Increasing SubsequenceONSITE INTERVIEW · Seen Oct 2025
  • Lowest Common Ancestor with Repeated and Missing ValuesONSITE INTERVIEW · Seen Oct 2025
  • Shortest Substring with Exactly K OnesONSITE INTERVIEW · Seen Oct 2025
  • Middle Element of a Linked ListONSITE INTERVIEW · Seen Nov 2024
  • Mirror Image Binary TreesONSITE INTERVIEW · Seen Sep 2024
  • Maximum Supplier ProfitONSITE INTERVIEW · Seen Aug 2024

Similar questions at other companies

  • Search a Row- and Column-Sorted MatrixByteDance · ONSITE INTERVIEWByteDance interview questions
  • First and Last Target Position in a Mountain ArrayGoogle · ONSITE INTERVIEWGoogle interview questions
  • 3Sum SmallerSalesforce · ONSITE INTERVIEWSalesforce interview questions
  • Smallest Batch Size Within a Step LimitMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Peak of an Increasing-Then-Decreasing ArraySnap Inc. · ONSITE INTERVIEWSnap Inc. interview questions
  • Online Meeting Scheduler with Fixed RoomsUber · ONSITE INTERVIEWUber interview questions
  • Search in a Rotated Sorted ArrayAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Search in Rotated Sorted ArrayKotak Mahindra Bank · ONSITE INTERVIEWKotak Mahindra Bank interview questions
  • Find First and Last Position in Sorted ArrayPaytm · ONSITE INTERVIEWPaytm interview questions
  • Detect a Silent SensorConfluent · ONSITE INTERVIEWConfluent interview questions

Interview reports that mention this question

  • Expedia SWE Intern Final Round: 126 Experiences (Part 1 of 6)

Expedia interview experiences

  • Expedia Intern Final Round in 2021: 28 Experiences (Part 4 of 6)
  • Expedia Intern Finals Before 2020: 14 Experiences (Part 6 of 6)
  • Expedia Intern Final Round in 2020: 24 Experiences (Part 5 of 6)
  • Expedia Intern Final Round in 2022: 15 Experiences (Part 3 of 6)
  • Expedia Intern Final Round in 2023: 17 Experiences (Part 2 of 6)
All Expedia interview questionsSee Expedia hiring insights
Saved
class Solution {
    public int findMin(int[] nums) {
        // Write your code here.
    }
}
Checking account…