Practice Split Array by Prime Indices
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Separate nums entries by their zero-based indices: prime indices go into A and every other index goes into B. Return |sum(A) - sum(B)|, treating an empty sum as zero.
Source: Split Array by Prime Indices on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
nums = [2,3,4]
Output
1
# Example 2
Input
nums = [-1,5,7,0]
Output
3
Constraints
1 <= nums.length <= 10^5
-10^9 <= nums[i] <= 10^9
Related LeetCode Problems
Practice more problems similar to Split Array by Prime Indices.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.