Amazon interview question

Simplified version of LC 937. Reorder Data in Log Files