FastPrepMaximum Strictly Decreasing Index Gap
Problems/Maximum Strictly Decreasing Index Gap

Maximum Strictly Decreasing Index Gap

Expedia logoExpedia● MediumFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report's relation values[i]>values[j] is kept exactly. We chose how to handle empty input and no pair, and the limits. Our version is about 97% the same as the reported question.

Find the largest j-i over positions satisfying 0 <= i < j < values.length and values[i] > values[j]. The comparison is strict.

Return -1 when no such pair exists, including arrays with fewer than two entries.

Function

maximumGap(values: int[]) → int

Examples

Example 1

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

values[0]=5 is greater than values[3]=2, giving the maximum possible gap, 3.

Example 2

values = [1,2,3]return = -1

No earlier value is greater than a later value.

Constraints

  • 0 <= values.length <= 10000.
  • -1000000000 <= values[i] <= 1000000000.

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
  • Minimum in a Rotated Sorted ArrayONSITE INTERVIEW · Seen Sep 2024
  • Mirror Image Binary TreesONSITE INTERVIEW · Seen Sep 2024

Similar questions at other companies

  • Search a Row- and Column-Sorted MatrixByteDance · ONSITE INTERVIEWByteDance interview questions
  • Shortest Window with Required CountsOracle · ONSITE INTERVIEWOracle interview questions
  • 3Sum SmallerSalesforce · ONSITE INTERVIEWSalesforce interview questions
  • Sort Ones, Twos, and Threes In PlaceAgoda · PHONE SCREEN · ONSITE INTERVIEWAgoda interview questions
  • Minimum Station Tracks for a Train ScheduleBNSF Railway · ONSITE INTERVIEWBNSF Railway interview questions
  • Candy Crush Grid Matching and GravityRoblox · PHONE SCREEN · ONSITE INTERVIEWRoblox interview questions
  • Longest Binary Window with at Most K OnesLinkedIn · ONSITE INTERVIEWLinkedIn interview questions
  • Rotate an Array Right by K StepsQualys · ONSITE INTERVIEWQualys interview questions
  • Find the Duplicate NumberWalmart Labs · ONSITE INTERVIEW
  • Two or Three Sum ExistenceGoogle · ONSITE INTERVIEWGoogle interview questions

Interview reports that mention this question

  • Expedia New Grad SDE Oldest Loops: 4 Experiences (Part 3 of 3)

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 maximumGap(int[] values) {
        // Write your code here.
    }

}
Checking account…