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.
Tip for Java users: if you're getting timeouts, it could be because Java I/O with scanner (like in the starter code provided) is too slow. Try using a faster custom-made input reader.
Was getting timeouts for all test cases from #6. Changed input scanner to this FastReader class provided by geeksforgeeks, and the same implementation passed all test cases without a sweat.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Cut the Tree
You are viewing a single comment's thread. Return to all comments →
Tip for Java users: if you're getting timeouts, it could be because Java I/O with scanner (like in the starter code provided) is too slow. Try using a faster custom-made input reader.
Was getting timeouts for all test cases from #6. Changed input scanner to this FastReader class provided by geeksforgeeks, and the same implementation passed all test cases without a sweat.