3115. Maximum Prime Difference
You are given an integer array nums. Return an integer that is the maximum distance between the indices of two (not necessarily different) prime numbers in nums. Example 1: Input: nums = [4,2,9,5,3] Output: 3 Explanation: nums[1], nums[3], and nums[4] are prime. So the answer is |4 - 1| = 3. Example 2: Input: nums = [4,8,2,8] Output: 0 Explanation: nums[2] is prime. Because there is jus
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.
Sign in to chat with the tutor and save your progress.
Sign in to start