Typescript Count Unique Values Python Interview Question