3146. Permutation Difference between Two Strings
You are given two strings
s
andt
such that every character occurs at most once ins
andt
is a permutation ofs
.The permutation difference between
s
andt
is defined as the sum of the absolute difference between the index of the occurrence of each character ins
and the index of the occurrence of the same character int
.Return the permutation difference between
s
andt
.
1 | class Solution { |