Easy to understand TypeScript solution
Code\n\nfunction distinctDifferenceArray(nums: number[]): number[] {\n    let diffs = new Array(nums.length);\n\n    for(let i=0; i<nums.length; i++){\n        
# Code\n```\nfunction distinctDifferenceArray(nums: number[]): number[] {\n    let diffs = new Array(nums.length);\n\n    for(let i=0; i<nums.length; i++){\n        for(let i=0; i<nums.length; i++){\n        let prefix = new Set( nums.slice(0, i + 1));\n        let suffix = new Set( nums.slice(i+1, nums.length+1));\n        diffs[i] = prefix.size - suffix.size;\n    }\n\n    return diffs;\n};\n```
['TypeScript']