Search
⌘K

Leetcode 3361. Shift Distance Between Two Strings

Given s and t, compute the minimum total cost to transform each character of s into the corresponding character of t by rotating letters on a 26-node directed cycle where the edge j->(j+1) costs nextCost[j] and j->(j-1) costs previousCost[j]; for each position, take the shortest-path cost between the two letters and sum them.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.