Updated abs_distinct to O(n) by removing Object.keys(), which has a worst case of O(n)