← All problemsSign in

3377. Digit Operations to Make Two Integers Equal

LeetCodeMathGraph TheoryHeap (Priority Queue)Number TheoryShortest PathOpen on judge ↗

You are given two integers n and m that consist of the same number of digits. You can perform the following operations any number of times: - Choose any digit from n that is not 9 and increase it by 1. - Choose any digit from n that is not 0 and decrease it by 1. The integer n must not be a prime number at any point, including its original value and after each operation. The cost of a transfo

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start