Simple || Clean || Java Solution
\njava []\nclass Solution {\n    public int[] distinctDifferenceArray(int[] nums) {\n        Set<Integer> pre = new HashSet();\n        int res[] = new int[nums
\n```java []\nclass Solution {\n    public int[] distinctDifferenceArray(int[] nums) {\n        Set<Integer> pre = new HashSet();\n        int res[] = new int[nums.length];\n        for(int i=0; i<nums.length; i++){\n            pre.add(nums[i]);\n            Set<Integer> suf = new HashSet();\n            for(int j=i+1; j<nums.length; j++)  suf.add(nums[j]);\n            res[i] = pre.size()-suf.size();\n        }\n        return res;\n    }\n}\n```
['Java']