AbsDistinct
def solution(A):
# write your code in Python 3.6
B=[]
count=0
for i in A:
if abs(i) not in B:
B.append(abs(i))
count+=1
return count
답은 맞는데 역시나 time error 나는군
def solution(A):
# write your code in Python 3.6
B={}
#count=0
for i in A:
if abs(i) not in B:
B[abs(i)] = 1 # . append(abs(i))
#count+=1
return len(B)
dictionary를 이용해서 자동으로 값이 덮어 씌워지게 해서 if 문을 생략했고, dictionary의 길이를 반환