Pregunta de entrevista de Vanguard

What is a pointer? What is a stack and how would you use one? How would you tell if two strings are permutations?

Respuesta de la entrevista

Anónimo

23 ago 2018

"AAB" "ABA" ans1: sort each string and compare ans2: store each character from the first string in a hashmap that takes the letter as a key and its frequency as the value. iterate through the second string and subtract one from the value of the corresponding letter. if the hashmap values are all zero than it is a permutation.