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 | 158 Views, 40646 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 | 158 Views, 40646 Search Bots | 66 Words Subscribe to Feed Burner

Related Articles

  1. Daily Interview Question: Edit Distance
  2. [Daily Problem] Course Prerequisites
  3. [Daily Problem] Remove Consecutive Nodes that Sum to 0
  4. Staying on a Chess Board
  5. Daily Interview Problem: Min Range Needed to Sort
  6. Daily Interview Problem: Circle of Chained Words
  7. Daily Interview Question: Create a Simple Calculator
  8. Two Tricks of Delphi
  9. Algorithm Interview Question: Find the Single Element in an Array of Duplicates
  10. Algorithm Interview: Smallest Number that is not a Sum of a Subset of 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" />