You are given two strings s and t of the same length, along with two integer arrays nextCost and previousCost of length
In one operation, you can transform a character at index i of s into:
The next character in alphabetical order, wrapping around from 'z' to 'a'. The cost of shifting character nextCost[c], where 'a' to 'z'.
The previous character in alphabetical order, wrapping around from 'a' to 'z'. The cost of shifting character previousCost[c], where 'a' to 'z'.
The shift distance from s to t is the sum of the minimum costs required to convert each s[i] to t[i] for all valid indices i.
Return an integer representing the minimum shift distance to transform s into t.
Constraints:
s.length t.length
s and t consist only of lowercase English letters.
nextCost.length previousCost.length
nextCost[i], previousCost[i]
You are given two strings s and t of the same length, along with two integer arrays nextCost and previousCost of length
In one operation, you can transform a character at index i of s into:
The next character in alphabetical order, wrapping around from 'z' to 'a'. The cost of shifting character nextCost[c], where 'a' to 'z'.
The previous character in alphabetical order, wrapping around from 'a' to 'z'. The cost of shifting character previousCost[c], where 'a' to 'z'.
The shift distance from s to t is the sum of the minimum costs required to convert each s[i] to t[i] for all valid indices i.
Return an integer representing the minimum shift distance to transform s into t.
Constraints:
s.length t.length
s and t consist only of lowercase English letters.
nextCost.length previousCost.length
nextCost[i], previousCost[i]