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.
read() uses the delimiter 'space' to parse the value, so it can't detect the space between the string but readLine() goes through the string so it can detect the in-between the spaces.
But Since the readLine() goes through the entire string, it takes more time than the read() which only uses the delimiter.
Hope that helps.
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 →
read() uses the delimiter 'space' to parse the value, so it can't detect the space between the string but readLine() goes through the string so it can detect the in-between the spaces. But Since the readLine() goes through the entire string, it takes more time than the read() which only uses the delimiter. Hope that helps.