Advertisement
smj007

Untitled

Mar 9th, 2025
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. class Solution:
  2.     def checkIfExist(self, arr: List[int]) -> bool:
  3.         hashmap = {}
  4.        
  5.         for ind, num in enumerate(arr):
  6.             hashmap[num] = ind
  7.            
  8.         for i in range(len(arr)):
  9.             if 2*arr[i] in hashmap and hashmap[2*arr[i]] != i:
  10.                 return True
  11.            
  12.         return False
  13.                
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement