Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Crazy hard question #13

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

@prakashn27 prakashn27 commented Aug 19, 2015

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

@santhoshvai santhoshvai commented Aug 19, 2015

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.