Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 386 Bytes

README.md

File metadata and controls

18 lines (14 loc) · 386 Bytes

Smallest, unrepresented integer

Given a sorted (sorted in non-decreasing order) array of positive numbers, can you find the smallest positive integer that cannot be represented as a sum of elements from the array?

Input:  arr[] = {1, 3, 6, 10, 11, 15};
Output: 2
Input:  arr[] = {1, 1, 1, 1};
Output: 5
Input:  arr[] = {1, 1, 3, 4};
Output: 10