3618. Split Array by Prime Indices
You are given an integer array nums. Split nums into two arrays A and B using the following rule: - Elements at prime indices in nums must go into array A. - All other elements must go into array B. Return the absolute difference between the sums of the two arrays: |sum(A) - sum(B)|. Note: An empty array has a sum of 0. Example 1: Input: nums = [2,3,4] Output: 1 Explanation: - The only
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