Tap here to switch tabs
Problem
Submissions

Problem: Maximum Prime Difference

Maximum Prime Difference asks you to examine an integer array and return the greatest distance between the indices of any two elements whose values are prime.

Statement

You are given an integer array nums.

Return the maximum distance between the indices of any two prime numbers in nums.

Constraints:

  • 1≤1 \leq nums.length ≤3×105\leq 3 \times 10^5

  • 1≤1 \leq nums[i] ≤100\leq 100

  • The input is generated such that nums contains at least 11 prime number.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Prime Difference

Maximum Prime Difference asks you to examine an integer array and return the greatest distance between the indices of any two elements whose values are prime.

Statement

You are given an integer array nums.

Return the maximum distance between the indices of any two prime numbers in nums.

Constraints:

  • 1≤1 \leq nums.length ≤3×105\leq 3 \times 10^5

  • 1≤1 \leq nums[i] ≤100\leq 100

  • The input is generated such that nums contains at least 11 prime number.