1708. Largest Subarray Length K

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 1708

class Solution:
    def largestSubarray(self, nums: List[int], k: int) -> List[int]:
        i = nums.index(max(nums[: len(nums) - k + 1]))
        return nums[i : i + k]