Engineering Full Stack Apps with Java and JavaScript
Merge two sorted arrays A and B in sorted order. A has enough locations in the end to hold the elements of B.
No extra buffer should be used.
Every element should be shifted from its current position in A, at most 1 time.
Hint:
Start filling from the end of A.
Sort an array of Strings. All anagrams should be next to each other.
Hint:
Approach 1: Modify the comparator to indicate that two anagrams are equal, and then sort.
Approach 2: Using a hash table that maps from the sorted version of a word to a list of its anagrams.
How will you sort a very big file (approx 20GB) with one String per line
Hint:
Don't bring all data into memory.
Use external sort: Divide into chunks, sort the chunks and merge the sorted chunks.