Amazon interview question

Anagram DSA question medium difficulty