728x90
https://leetcode.com/problems/check-if-n-and-its-double-exist/
class Solution:
def checkIfExist(self, arr: List[int]) -> bool:
arr.sort()
for i in range(len(arr)):
for j in range(len(arr)):
if i == j:
continue
if arr[i] * 2 == arr[j]:
return True
return False
728x90
'IT > 코딩테스트' 카테고리의 다른 글
[Leetcode] 584. Find Customer Referee (0) | 2023.08.22 |
---|---|
[Leetcode] 1757. Recyclable and Low Fat Products (0) | 2023.08.21 |
[Leetcode] 977. Squares of a Sorted Array (0) | 2023.08.19 |
[Leetcode] 1295. Find Numbers with Even Number of Digits (0) | 2023.08.19 |
[Leetcode] 485. Max Consecutive Ones (0) | 2023.08.19 |