Available question text
Find the maximum distance j - i (i < j) such that nums[i] <= nums[j] in the array — i.e., the farthest valid "ramp". With n up to 5·10^4, brute force is too slow; this is typically solved with a monotonic decreasing stack or by sorting value-index pairs to achieve near-linear or n log n time.
Related questions
Continue with questions that share topics or the same question type.
- Maximum Width of Binary Tree
Coding
- All the Pairs With the Maximum Number of Common Followers
Coding
- Average Salary Excluding the Minimum and Maximum Salary
Coding
- Binary Tree Maximum Path Sum
Coding · Binary Tree · Depth-First Search · DP on Trees
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 962. Maximum Width Ramp
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source