Skip to content

Crazy hard question #13

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
santhoshvai opened this issue Aug 18, 2015 · 2 comments
Open

Crazy hard question #13

santhoshvai opened this issue Aug 18, 2015 · 2 comments
Labels

Comments

@prakashn27
Copy link
Contributor

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. 🔢 will look into it and let u know.

@santhoshvai
Copy link
Contributor Author

I can also understand this. The challenge is to do it in less than O(n lgn). O(n) solution needed

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants