Monday, December 24, 2012

Sort by Anagrams

Book: Cracking the Coding Interview
Question: 11.2 (page 121)

Write a method to sort an array of strings so that all the anagrams are next to each other.

Solution: Complexity - O(nlogn) [because of TreeMap]


No comments:

Post a Comment