1950. Maximum of Minimum Values in All Subarrays
https://leetcode.com/problems/maximum-of-minimum-values-in-all-subarrays
Description
You are given an integer array nums
of size n
. You are asked to solve n
queries for each integer i
in the range 0 <= i < n
.
To solve the ith
query:
Find the minimum value in each possible subarray of size
i + 1
of the arraynums
.Find the maximum of those minimum values. This maximum is the answer to the query.
Return a 0-indexed integer array ans
of size n
such that ans[i]
is the answer to the ith
query.
A subarray is a contiguous sequence of elements in an array.
Example 1:
Example 2:
Constraints:
n == nums.length
1 <= n <= 105
0 <= nums[i] <= 109
ac
Last updated