Practice Find Original Array From Doubled Array
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
An integer array original is transformed into a doubled array changed by appending twice the value of every element in original, and then randomly shuffling the resulting array. Given an array changed, return original if changed is a doubled array. If changed is not a doubled array, return an empty array. The elements in original may be returned in any order.
Source: Find Original Array From Doubled Array on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
changed = [1,3,4,2,6,8]
[1,3,4]
# Example 2
changed = [6,3,0,1]
[]
# Example 3
changed = [1]
[]
Constraints
Related LeetCode Problems
Practice more problems similar to Find Original Array From Doubled Array.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.