Code:
class Solution:
def checkIfExist(self, arr: List[int]) -> bool:
g=0;
for i in arr:
if(i*2 in arr and i!=0):
g=1;
break;
elif(i*2 in arr and arr.count(2*i)>=2):
g=1;
break;
if(g==0):
return False;
else:
return True;
Problem Link: Check If N and Its Double Exist: https://leetcode.com/problems/check-i... Python for beginners: https://www.youtube.com/watch?v=egq7Z...
Problem Link: Check If N and Its Double Exist: https://leetcode.com/problems/check-i... Python for beginners: https://www.youtube.com/watch?v=egq7Z...
0 Comments:
Post a Comment