Interview-Questions
Interview-Questions copied to clipboard
Crazy hard question
Same problem??
- http://stackoverflow.com/questions/21060873/minimum-sum-that-cant-be-obtained-from-a-set
- https://www.codechef.com/JAN14/problems/FRBSUM
I find this solution to be easy:
Sort(A)
candidate = 1
for i from 1 to length(A):
if A[i] > candidate: return candidate
else: candidate = candidate + A[i]
return candidate
First solution is crazy. :1234: will look into it and let u know.
I can also understand this. The challenge is to do it in less than O(n lgn). O(n) solution needed