Find Doubles

Problem Overview

  • Identify all integers in a list for which exactly one element in the same list is twice their value.
  • Input: list of N integers (0–1000, up to 100,000 items, values may repeat); Output: print qualifying numbers in sorted order to STDOUT.
  • Domain: list/data analysis and validation where x and 2x relationships matter.
  • From Purestorage interviews; a common coding interview problem and interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: