• 29.4%

https://leetcode.com/problems/minimum-size-subarray-sum/

Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ≥ s. If there isn’t one, return 0 instead.

More practice:

If you have figured out the O(n) solution, try coding another solution of which the time complexity is O(n log n).

8ms, 14.16%, June.24th, 2016

https://leetcode.com/discuss/42143/4ms-o-n-8ms-o-nlogn-c

https://discuss.leetcode.com/topic/37844/o-n-template-for-minimum-size-subarray-sum-minimum-window-substring-longest-substring-without-repeating-characters

O(N) template for Minimum Size Subarray Sum & Minimum Window Substring & Longest Substring Without Repeating Characters

First , I will show you the solution of this problem,

Next, let me show you the solution to the problem “Minimum Window Substring”

The solution for the problem “Longest Substring Without Repeating Characters” can also be solved in the

same pattern .

Here is the solution for “Longest Substring Without Repeating Characters”

As you can see, they all follow the same pattern !

This post deserves your up vote!

1ms, 16.03%, June.24th, 2016

https://leetcode.com/discuss/45449/accepted-clean-java-o-n-solution-two-pointers

47ms, 96.87%, June.24th, 2016

https://leetcode.com/discuss/36384/python-o-n-and-o-n-log-n-solution