Easy Solution C++ Beginner Friendly
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> ans;\n        int n=nums.size();\n        for(int i=0;i<n;i++){\n            int ele=nums[i];\n            set<int> back;\n            set<int> forw;\n             for(int j=i+1;j<n;j++){\n                 forw.insert(nums[j]);\n             }\n             for(int j=i;j>=0;j--){\n                 back.insert(nums[j]);\n             }\n            int p=back.size()-forw.size();\n            ans.push_back(p);\n        }\n        return ans;\n    }\n};\n```
['C++']