FunctionRacerProblemsRace

Check If N and Its Double Exist

EasyHash mapsPython, JavaScript, TypeScript, Java, C++

Return True if there are two different positions i and j in arr with arr[i] == 2 * arr[j]. Otherwise return False.

Watch out for 0: it is its own double, so it needs to appear twice.

Example 1

arr [10,2,5,3]
returns true

10 is the double of 5.

Example 2

arr [3,1,7,11]
returns false

No item is twice another.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Hash maps problems