Given an array of integers nums, write a function to count the occurrences of each distinct element and return a dictionary where the keys are the distinct elements and the values are their respective counts.
Example 1:
Input: nums = [1, 2, 2, 3, 3, 3]
Output: {1: 1, 2: 2, 3: 3}
Example 2:
Input: nums = [4, 4, 5, 6, 6, 6, 7]
Output: {4: 2, 5: 1, 6: 3, 7: 1}
0 <= nums.length <= 10^5-10^9 <= nums[i] <= 10^9