Simple to understand
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```python3 []\nclass Solution:\n    def distinctDifferenceArray(self, nums: List[int]) -> List[int]:\n        n = len(nums)\n        prefix = [0] * n\n        suffix = [0] * n\n        \n        seen = set()\n        i = 0\n        while i <= n - 1:\n            seen.add(nums[i])\n            prefix[i] = len(seen)\n            i += 1\n\n        seen = set()\n        i = n - 1\n        while i >= 0:\n            suffix[i] = len(seen)\n            seen.add(nums[i])\n            i -= 1\n\n        return [prefix[j] - suffix[j] for j in range(n)]\n```
['Hash Table', 'Python3']