To the Top
File:  root - text - article - 2019 - 11 - minimum-size-subarray-sum.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, | English | Home Page | Category: Computing | 201 Views, 14174 Search Bots | 81 Words

Subscribe to Feed Burner | Browse | Archive
Hi, here's your problem today. This problem was recently asked by Amazon:

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.

Example:
Input: s = 7, nums = [2,3,1,2,4,3]
Output: 2
Explanation: the subarray [4,3] has the minimal length under the problem constraint.

Here is the method signature:


class Solution:
def minSubArrayLen(self, nums, s):
# Fill this in

print Solution().minSubArrayLen([2, 3, 1, 2, 4, 3], 7)
# 2
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, | English | Home Page | Cateogry: Computing | 201 Views, 14174 Search Bots | 81 Words Subscribe to Feed Burner

Related Articles

  1. A trick for getting good at coding interviews FASTER
  2. Absolute Path
  3. Kaprekar
  4. Daily Interview Problem: Merge Overlapping Intervals
  5. Algorithm Interview: Maximum Path Sum in Binary Tree
  6. Daily Interview Problem: Maximum Profit From Stocks
  7. Algorithm Interview: Determine If Linked List is Palindrome
  8. Top K Frequent words
  9. Daily Interview Problem: Look and Say Sequence
  10. [Daily Problem] Add two numbers as a linked list

Comments (0)

Your Email (Domain Part Not Exposed):

Your Comments:

Privately By Mail Colors More Smileys S x y @

Verification (Click Image 2 Refresh):

    Be the first one to comment this page !


Page Edited: October 30 2020 14:21:09 | RSS Subscription
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />