The Permutation Difference between Two Strings problem gives you two strings s and t that are permutations of each other. Compute the absolute difference sum: for each character c, |index_in_s(c) - index_in_t(c)|. This easy coding problem tests hash map index tracking. The hash table and string interview pattern is demonstrated.
Microsoft, Accenture, and Google ask this as a quick implementation problem testing index mapping with hash maps. It validates basic character tracking and absolute difference computation.
Hash map for character positions + sum of differences. Build pos_s[c] = index of c in s. Build pos_t[c] = index of c in t. Sum |pos_s[c] - pos_t[c]| for each character c.
s="abc", t="bac". pos_s: {a:0,b:1,c:2}. pos_t: {b:0,a:1,c:2}.
Character position mapping problems are straightforward hash map exercises. Always build separate maps for each string. The pattern pos_s[c] = index is O(n) to build and O(1) per lookup. Practice similar problems: "minimum swaps to convert s to t," "position difference with sorting." Clean hash map operations are the foundation for most string manipulation problems.