ServiceNow interview question

Alien Dictionary (leetcode hard problem)