Algorithm · Oracle · Medium
Given an integer array nums of length n and an integer k, examine every consecutive block containing exactly k elements. For each block, compute the smallest element. Return the largest value among all of these smallest elements. Formally, for each starting index $$i$$ where $$0 \le i \le n-k$$, let $$m_i = \min(nums[i], nums[i+1], \ldots, nums[i+k-1])$$ Then return $$\max(m_0, m_1, \ldots, m_{n-k})$$ The array may contain negative numbers. Example 1: Explanation: The…
Checking your access…