ServiceNow interview question

Related to Anagrams and array