We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
100% yes!
I wasted literally hours on test case #6 trying to optimise sorting, when I finally decided to time each step: sorting and writing back to file was taking altogether about 100ms. Reading the input via Scanner however was taking over 3000ms !!! Using instead [new BufferedReader(new InputStreamReader(System.in))] brought reading the input back down to about 30ms, or 100x less.
Great lesson learnt that I'll now apply to every other hackerrank challenge with remotely large test case input.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Big Sorting
You are viewing a single comment's thread. Return to all comments →
100% yes! I wasted literally hours on test case #6 trying to optimise sorting, when I finally decided to time each step: sorting and writing back to file was taking altogether about 100ms. Reading the input via Scanner however was taking over 3000ms !!! Using instead [new BufferedReader(new InputStreamReader(System.in))] brought reading the input back down to about 30ms, or 100x less. Great lesson learnt that I'll now apply to every other hackerrank challenge with remotely large test case input.