menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Data Science News

>

1346. Chec...
source image

Dev

1M

read

220

img
dot

Image Credit: Dev

1346. Check If N and Its Double Exist

  • Given an array arr of integers, check if there exist two indices i and j such that arr[i] == 2 * arr[j].
  • The solution involves using a hash table to track the elements encountered while iterating through the array.
  • For each element arr[i], we check if arr[i] * 2 or arr[i] / 2 (if arr[i] is even) is in the hash table.
  • If a match is found, return true; otherwise, return false.

Read Full Article

like

13 Likes

For uninterrupted reading, download the app