head of positive integers. For every **distinct** value in it, count how many times it occurs.
Return a new list made of these counts, one node per distinct value. For example, the list 4 → 7 → 4 has two distinct values, so the answer has two nodes: 2 and 1.
The nodes of the answer may come in any order.head=list_node([4, 7, 4, 4, 9, 7]) → [1, 2, 3]
4 appears 3 times, 7 twice and 9 once. Any other order of these counts, such as [3, 2, 1], is accepted too.
head=list_node([5, 5, 5]) → [3]
There is a single distinct value, and it appears three times.
head=list_node([8, 3, 8, 1]) → [1, 1, 2]
head=list_node([4, 7, 4, 4, 9, 7])
[1, 2, 3]
Run checks the first 3 tests in your browser. Submit checks all 56 tests on the server, hidden ones included.