You are given an integer array nums.
Split the elements of nums into two groups according to their indices:
An array A containing each element nums[i] where index i is a prime number.
An array B containing each element nums[i] where index i is not a prime number.
Return the absolute difference between the sum of the elements in A and the sum of the elements in B.
Note: An integer
is a prime number if its only positive divisors are and . The numbers and are not prime numbers.
Constraints:
nums.length
nums[i]
You are given an integer array nums.
Split the elements of nums into two groups according to their indices:
An array A containing each element nums[i] where index i is a prime number.
An array B containing each element nums[i] where index i is not a prime number.
Return the absolute difference between the sum of the elements in A and the sum of the elements in B.
Note: An integer
is a prime number if its only positive divisors are and . The numbers and are not prime numbers.
Constraints:
nums.length
nums[i]