Peeush Agarwal > Engineer. Learner. Builder.

I am a Machine Learning Engineer passionate about creating practical AI solutions using Machine Learning, NLP, Computer Vision, and Azure technologies. This space is where I document my projects, experiments, and insights as I grow in the world of data science.

View on GitHub

Minimum Size Subarray Sum

Given an array of positive integers nums and a positive integer target, find the minimal length of a contiguous subarray of which the sum is greater than or equal to target. If no such subarray exists, return 0.

Examples

Constraints

Follow-up
If you have solved the problem with an O(n) solution, try implementing an O(n log n) solution.

Code Template

class Solution:
    def minSubArrayLen(self, target: int, nums: List[int]) -> int:
        # Your code here
        pass

Solutions

Back to Problem List Back to Categories