Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 3146. Permutation Difference between Two Strings
Given two strings s and t where t is a permutation of s and each character is unique, compute the permutation difference defined as the sum over all characters of the absolute difference between their indices in s and t. This is essentially an index-mapping problem: map each character to its position in s and sum |pos_s[c] - pos_t[c]| for all characters (n ≤ 26).
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.