JavaScript
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:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n/**\n * @param {number[]} nums\n * @return {number[]}\n */\nvar distinctDifferenceArray = function(nums) {\n    const n = nums.length;\n    const diff = new Array(n).fill(0);\n    \n    for (let i = 0; i < n; i++) {\n            const prefix = new Set();\n            const suffix = new Set();\n        \n            prefix.add(nums[0]);        \n            for (let j = 1; j <= i; j++) {\n             if (!prefix.has(nums[j])) prefix.add(nums[j]);\n             }\n        \n            for (let j = i+1; j < n; j++) {\n             if(!suffix.has(nums[j])) suffix.add(nums[j]);\n             }\n                \n        const prefixSize = prefix.size;\n        const suffixSize = suffix.size;\n\n        diff[i] = prefixSize - suffixSize;\n    }\n\n    return diff;\n    \n};\n```
['JavaScript']