On Wednesday, May 9, 2018 at 1:20:55 AM UTC+8, Rajat Tanwar wrote:
> and used quick sort to sort the sub lists

Well, that's your problem right there. Quicksort is O(n²) in the worst case 
(with O(n) recursion depth), and really naive quicksort implementations, such 
as the one you wrote, can easily fall into the worst case. Just take 50000 
zeros as the input for example -> StackOverflowError.

But before you start frantically coding a better sort method, let me ask you: 
why didn't you simply use Arrays.sort from the standard library? It's 
available, it's correct and it's very fast.

Likewise, why did you code your own "FastReader" and not just use Scanner? It 
even has the same method names :)

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/a85092c2-2e55-4fc0-a42f-4f12a3bc1dc1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to