Skip to content

Files

Latest commit

author
Shuo
Nov 27, 2021
cb30580 · Nov 27, 2021

History

History

maximum-of-minimum-values-in-all-subarrays

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Nov 27, 2021

< Previous                  Next >

Related Topics

[Stack] [Array] [Monotonic Stack]

Hints

Hint 1 Imagine the array is empty, and each element is coming to its index one by one, starting with the smallest element.
Hint 2 For each coming element nums[i], calculate L and R, the indices of the first smallest elements on the left and the right respectively.
Hint 3 The answer of the queries from 1 to R-L+1 will be at least this element.