To the Top
File:  root - text - article - 2020 - 01 - smallest-number-that-is-not-a-sum-of-a-subset-of-list.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 216 Views, 44425 Search Bots | 66 Words

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

Given a sorted list of positive numbers, find the smallest positive number that cannot be a sum of any subset in the list.

Example:
Input: [1, 2, 3, 8, 9, 10]
Output: 7
Numbers 1 to 6 can all be summed by a subset of the list of numbers, but 7 cannot.


def findSmallest(nums):
# Fill this in.

print findSmallest([1, 2, 3, 8, 9, 10])
# 7
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Cateogry: Computing | 216 Views, 44425 Search Bots | 66 Words Subscribe to Feed Burner

Related Articles

  1. CVE-2015-8874 - cPanel EasyApache Vulnerabilities
  2. Daily Interview Problem: Distribute Bonuses
  3. New Vulnerabilities (CVE-2016-4581) have been detected in CentOS/RHEL/CloudLinux 7
  4. ImageMagick Vulnerabilities -  CVE-2016–3714
  5. [Daily Problem] Remove k-th Last Element From Linked List
  6. Daily Interview Problem: Full Binary Tree
  7. Daily Interview Problem: Group Words that are Anagrams
  8. [Daily Problem] Witness of The Tall People
  9. Find Pythagorean Triplets
  10. Skip the readings, focus on problems. And use all the hints!

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" />