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 | 257 Views, 16736 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 | 257 Views, 16736 Search Bots | 81 Words Subscribe to Feed Burner

Related Articles

  1. Print a tree level-by-level, with line-breaks
  2. CVE-2015-8874 - cPanel EasyApache Vulnerabilities
  3. [Daily Problem] Witness of The Tall People
  4. Algorithm Interview Question: Max and Min with Limited Comparisons
  5. Longest Substring Without Repeating Characters
  6. New Vulnerabilities (CVE-2016-4581) have been detected in CentOS/RHEL/CloudLinux 7
  7. Design Tic-Tac-Toe
  8. ImageMagick Vulnerabilities -  CVE-2016–3714
  9. Daily Interview Problem: Min Stack
  10. First and Last Indices of an Element in a Sorted Array

Comments (0)

    Be the first one to comment this page !


Page Edited: May 11 2024 14:36:49 | RSS Subscription
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />