c++ solution || easy 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:\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```\nclass Solution {\npublic:\n    vector<int> distinctDifferenceArray(vector<int>& nums) {\n        vector<int>arr(nums.size());\n        int index;\n        set<int>set;\n        \n        for(int i=0;i<nums.size();i++){\n            int left=0;\n            int right =0;\n            for(int j=0;j<=i;j++){\n                set.insert(nums[j]);\n        }\n            left =set.size();\n            set.clear();\n            \n            for(int k= i+1;k<nums.size();k++){\n                set.insert(nums[k]);\n        }\n            right  =set.size();\n            set.clear();\n            arr[index++]= left -right;\n    }\n        return arr;\n    }\n};\n```
['Ordered Set', 'C++']