Given an array, put all repeated characters together.
Anonymous
depending on the requested space complexity you don't have to sort the chars inside the string. there are only 26 chars in the alphabet. so, you can have a map or an int array with 26 counters. each counter i will say how many times the char 'a' + i appears in the string. then iterate once over the string incrementing the specific counters and in the end display the map or array.
Check out your Company Bowl for anonymous work chats.