Compute number of distinct absolute values of sorted array elements.
expected worst-case time complexity is O(N)
expected worst-case space complexity is O(N)
Additional storage is allowed. Therefore a simple python solution will suffice.
def solution(A):
return len(set([abs(x) for x in A]))