Programming Monks
453 subscribers
49 photos
2 files
1.24K links
Code->Debug->Repeat.

Cause problems never end.
Download Telegram
Today's question
Intern - Deep Learning in Hyderabad, India - Xilinx
https://careers.xilinx.com/jobs/4890261-intern-deep-learning
Today's question
Today's question

Given a sorted array, find the smallest positive integer that is not the sum of a subset of the array.

For example, for the input [1, 2, 3, 10], you should return 7.

Explanation: 1, 2, 3 already there. 1 + 3 = 4, 3 + 2 = 5, 3+1+2 = 6. 1 to 6 all are not applicable. Thus 7 becomes the smallest number, that is NOT the sum of subset.

Time complexity:O(N) 
Programming Monks pinned «Today's question Given a sorted array, find the smallest positive integer that is not the sum of a subset of the array. For example, for the input [1, 2, 3, 10], you should return 7. Explanation: 1, 2, 3 already there. 1 + 3 = 4, 3 + 2 = 5, 3+1+2 = 6. 1…»
Today's question
Today's question
Today's question
Today's question