Check if N and Its Double Exist Problem

Check if N and Its Double Exist Problem — ExecCode Easy DSA Practice

Solve the Check if N and Its Double Exist problem on ExecCode. Free online easy DSA practice in Hashing. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Description You are given an array arr of integers, check if there exist two indices i and j such that :. Your task is to - i != j - 0 <= i, j < arr.length - arr[i] == 2 arr[j]. Return the required answer exactly as shown in the examples.

Examples

Input {"nums": [10, 2, 5, 3]}; Output True. Input {"nums": [3, 1, 7]}; Output False. Input {"nums": [0, 0, 0, 0, 0]}; Output True

Constraints

2 <= arr.length <= 500 -10^3 <= arr[i] <= 10^3

Practice Check if N and Its Double Exist free on ExecCode. Browse DSA problems, topic map, and placement guides.