AbsDistinct

Compute number of distinct absolute values of sorted array elements.

 

[최초풀이]

# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")

def solution(A):
    res = set()
    for a in A:
        res.add(abs(a))

    return len(res)

CountDistinctSlices

Count the number of distinct slices (containing only unique numbers).

+ Recent posts