Search
⌘K

Leetcode 3377. Digit Operations to Make Two Integers Equal

Find the minimum total cost to transform integer n into m by repeatedly incrementing or decrementing any single digit by 1 (digits remain same length), where each visited number contributes its numeric value to the cost and any prime-valued intermediate state (including start) is forbidden; return -1 if no valid sequence exists.


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.