CodingMedium
Minimum journey cost between two numbers via primes
Filed under PhonePe
The question
Compute minimum cost to travel from n1 to n2, where moving between primes costs their difference, non-prime to non-prime is not allowed, and a number whose digit-sum reduction is prime connects to that digit at zero cost; print -1 if impossible.
No write-up yet. Related questions below have one.
Related PhonePe questions
Collected from public candidate posts and coding forums. Updated Nov 2026.