Back to course home
0% completed
Solution: Find Original Array From Doubled Array
Problem Statement
A doubled array changed
is formed from the original
array after appending twice the value of each element in the original
array and randomly shuffling
elements in the updated original
array.
Given an array changed
, return the original
array if changed
is a valid doubled
array. Otherwise, return empty
array.
Examples
- Example 1:
- Input:
changed = [2,4,1,8]
- Expected Output:
[1,4]
- Justification: The original array [1,4] is doubled to form [2,4,1,8] (1's double is 2, and 4's double is 8).
- Input:
.....
.....
.....
Like the course? Get enrolled and start learning!
Table of Contents
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible