[LeetCode] Check If N and Its Double Exist (Python)
2024. 2. 29. 11:40ㆍ자료구조
class Solution:
def checkIfExist(self, arr: List[int]) -> bool:
for i in range(len(arr)):
for j in range(len(arr)):
if i != j:
if arr[i] == 2 * arr[j]:
return True
return False
'자료구조' 카테고리의 다른 글
[LeetCode] Replace Elements with Greatest Element on Right Side (Python) (0) | 2024.02.29 |
---|---|
[LeetCode] Valid Mountain Array (Python) (0) | 2024.02.29 |
[LeetCode] Remove Duplicates from Sorted Array (Python) (0) | 2024.02.27 |
[LeetCode] Remove Element (Python) (0) | 2024.02.27 |
[LeetCode] Merge Sorted Array (Python) (0) | 2024.02.27 |