Frequency and Prefix Set 
Intuition
Track unique elements in the prefix
•	As we move from left to right, maintain a prefix_set to count distinct elements up to i.
•	The size of this set
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
1.	Track unique elements in the prefix
	•	As we move from left to right, maintain a prefix_set to count distinct elements up to i.
	•	The size of this set gives us the number of distinct elements in the prefix.
2.	Track unique elements in the suffix efficiently
	•	Instead of recalculating distinct elements from i+1 every time (which would be slow), we start with all distinct elements in nums using a dictionary (suffix_count).
	•	As we move i forward, we remove elements from suffix_count, reducing its distinct count dynamically.
3.	Compute the distinct difference for each i
	•	diff[i] = (number of distinct elements in prefix) - (number of distinct elements in suffix)

# Approach
At an index i , you would require two things 
1) A prefix set of elements that already has been traversed
2) Rest of the unique elements set after index i  
2.a) Maintain a frequency dictionary so you would know which rest elements are present after i index.
2.b) At every index i add the curr_ele to prefix set and reduce it's frequency , if freq becomes 0 , delete the key . The total keys present at current index after deletion will the the suffix set at that index i.

# Complexity
- Time complexity:
  O(N)

- Space complexity:
O(N)

# Code
```python3 []
from collections import Counter

class Solution:
    def distinctDifferenceArray(self, nums: List[int]) -> List[int]:
        freq = Counter(nums)
        ans = [0]*len(nums)
        l_set = set()
        l_arr = [0]*len(nums)
        for i in range(len(nums)):
            l_set.add(nums[i])
            l_arr[i] = len(l_set)

        for i in range(len(ans)):
            freq[nums[i]] -= 1
            if freq[nums[i]] == 0:
                del freq[nums[i]]
            
            ans[i] = l_arr[i] - len(freq)
            

        return ans



        

    


        

        
```
['Python3']