Simple set solution JS/TS
Intuition\nI have seen all the solutions in which they are creating new set everytime inside loop. But we will only need to create new set everytime for right s
# Intuition\nI have seen all the solutions in which they are creating new set everytime inside loop. But we will only need to create new set everytime for right side but for the left we can just add.\n\n# Code\n```\nfunction distinctDifferenceArray(nums: number[]): number[] {\n    let leftSet = new Set<number>();\n\n    return nums.map((num,index)=>{\n        leftSet.add(num);\n        let rightSet = new Set<number>(nums.slice(index+1));\n        return leftSet.size-rightSet.size;\n    })\n};\n```
['TypeScript']