Search
⌘K
Get Premium
Leetcode 3629. Minimum Jumps to Reach End via Prime Teleportation
Find the minimum jumps from index 0 to n-1 in an array where you can move to adjacent indices or, if nums[i] is a prime p, instantly teleport to any index j (j ≠i) with nums[j] divisible by p. This reduces to a shortest-path/BFS on indices with special teleport edges induced by prime values, requiring efficient handling of prime divisibility across up to 1e5 elements (nums[i] ≤ 1e6).
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.