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.
Using BufferredReader instead of scanner works. New template (no spoiler on sort):
private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
public static void main(String[] args) throws IOException {
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH")));
int n = Integer.parseInt(reader.readLine());
String[] unsorted = new String[n];
for (int i = 0; i < n; i++) {
String unsortedItem = reader.readLine();
unsorted[i] = unsortedItem;
}
String[] result = bigSorting(unsorted);
for (int i = 0; i < result.length; i++) {
bufferedWriter.write(result[i]);
if (i != result.length - 1) {
bufferedWriter.write("\n");
}
}
bufferedWriter.newLine();
bufferedWriter.close();
reader.close();
}
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 →
Using BufferredReader instead of scanner works. New template (no spoiler on sort):