I want to sort a string “computer” -> “cemoprtu”, but without using Arrays.sort(string).
Advertisement
Answer
Looks like you need to sort the characters, so I’d start with
String input = "computer"; char[] characters = input.toCharArray(); //now sort characters using some algorithm String output = new String(sorted_characters); //sorted_characters might be characters after sorting, if you sort in place