FastPrepFind the Original Array From a Doubled Array
Problems/Find the Original Array From a Doubled Array

Find the Original Array From a Doubled Array

Google logoGoogle● MediumNEW GRADPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A firsthand new-grad report from Google describes building an array by doubling and shuffling, and the inverse follow-up. It gives the example [2,1,4,8] -> [1,4]. It points to the familiar doubled-array problem. Here the function returns the valid original array in sorted order, so the batch output is always the same.

An unknown array original contains non-negative integers. A changed array was formed by appending twice every value in original, then shuffling all values.

Given changed, reconstruct original and return it sorted from smallest to largest. Return an empty array when no valid original array exists.

Each occurrence is a separate element. In particular, every original zero requires a second zero as its doubled partner.

Function

findOriginalArray(changed: int[]) → int[]

Examples

Example 1

changed = [1,3,4,2,6,8]return = [1,3,4]

Values 1, 3, and 4 pair with 2, 6, and 8.

Example 2

changed = [6,3,0,1]return = []

No ordering can pair every value with its double.

Example 3

changed = [0,0,2,4]return = [0,2]

One zero pairs with the other zero, and 2 pairs with 4.

Constraints

  • 0 <= changed.length <= 200000.
  • changed.length is even.
  • 0 <= changed[i] <= 1000000000.

More Google Phone Screen questions

  • Route Pattern MatcherPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Periodic-Color Binary Forest RootsPHONE SCREEN · Seen Nov 2026
  • Evaluate a Nested Math ExpressionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Best Stock Trade with Buy and Sell DaysPHONE SCREEN · Seen Nov 2026
  • Word Chain Jumps in a GridPHONE SCREEN · Seen Nov 2026
  • Dice-Walk Winning ProbabilityPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Apartment Housemate PreferencesPHONE SCREEN · Seen Nov 2026
  • Price at Query TimestampsPHONE SCREEN · Seen Nov 2026
  • Course Schedule Cycle DetectionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Minimum Distinct Prefix CostChubb · OAChubb interview questions
  • Minimum Distinct Prefix CostGoldman Sachs · OAGoldman Sachs interview questions
  • Rearrange Songs by AuthorZomato / Eternal · OAZomato / Eternal interview questions
  • Nickname-Constrained GroupingZoox · ONSITE INTERVIEW
  • Partition Into K-Size Consecutive GroupsDream11 · ONSITE INTERVIEWDream11 interview questions
  • Find Max Health SumAmazon · OA
  • Fair Capped Money DistributionGusto · PHONE SCREEN · ONSITE INTERVIEWGusto interview questions
  • Mutual-Friend RecommendationsMeta · PHONE SCREEN · ONSITE INTERVIEWMeta interview questions
  • Filter, Sort, and Deduplicate Scheduled TasksRippling · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions
  • Tennis Court SchedulingAtlassian · PHONE SCREEN · ONSITE INTERVIEWAtlassian interview questions

Interview reports that mention this question

  • Google New Grad R1 Original From Doubled Array: 1 Experience

Google interview experiences

  • Google interviews · November 2026
  • Google Software Engineer Onsite Questions: 10 Experiences
  • Google OA: What It Tests (2026)
  • Google L4 SWE Phone Screen: 1 Experience
  • Google ML Engineering Manager Onsite: 1 Experience
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public int[] findOriginalArray(int[] changed) {
        // Write your code here.
    }
}
Checking account…