Explained - using map || Very Simple & Easy to Understand Solution
 Up vote if you like the solution \n\n# Approach\nTake two map, one to have the prefix indexed (mp) & second one is suffix indexed (rmp ).\nFirst evaluate the s
<b> Up vote if you like the solution </b>\n\n# Approach\nTake two map, one to have the prefix indexed (mp) & second one is suffix indexed (rmp ).\nFirst evaluate the suffix mapping of all element by traversing and indexing all elements\nThen on second traverse start mapping the prefix index and removing the same from suffix mapping.\n    - Need to erase the index if its occurance is zero.\nTake diff of the size of the maps & store in to the ans array.\n        \n        \n```\n    vector<int> distinctDifferenceArray(vector<int>& nums) {\n        vector<int> ans;\n        unordered_map<int,int> mp, rmp;\n        for(auto n: nums){ rmp[n]++; }\n        for(auto n: nums){\n            mp[n]++;\n            rmp[n]--;\n            if(rmp[n] == 0) rmp.erase(n);\n            ans.push_back(mp.size() - rmp.size());\n        }\n        return ans;\n    }\n```\n\n<b>Here is an article of my last interview experience - A Journey to FAANG Company, I recomand you to go through this to know which all resources I have used & how I cracked interview at Amazon:\nhttps://leetcode.com/discuss/interview-experience/3171859/Journey-to-a-FAANG-Company-Amazon-or-SDE2-(L5)-or-Bangalore-or-Oct-2022-Accepted
['C++']