Description
Solutions
Find Doubles
🤘 INTERN📚RELATED PROBLEMS
Given a list of N
integers, not necessarily unique, find all elements of the list for which there exists exactly one element of the list which is twice that number. The integers range from 0
to 1000
. The list has no more than 100,000
elements.
Your code should find the appropriate values and print them to STDOUT in sorted order.
Example 1:
Input: numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 8]
Output: [0, 1, 2, 3]
Explanation:
8
is4*2
, but8
is present twice,0
is its own double, so it's part of the result.
Example 2:
Input: numbers = [7, 17, 11, 1, 23]
Output: []
Explanation:Nothing is exactly twice another element.
Example 3:
Input: numbers = [1, 1, 2]
Output: [1, 1]
Explanation:
1
and1
both have their double2
present, and2
is present in the list only once.
Constraints:
TO-DO

Related Problems
Testcase
Result
Case 1
input:
output: