Skip to content

Commit

Permalink
leetcode perm diff of two strings
Browse files Browse the repository at this point in the history
  • Loading branch information
ferhatelmas committed May 13, 2024
1 parent 7216dba commit 7d33c96
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class Solution:
def findPermutationDifference(self, s: str, t: str) -> int:
d = {e: i for i, e in enumerate(s)}
return sum(abs(i - d[e]) for i, e in enumerate(t))

0 comments on commit 7d33c96

Please sign in to comment.