C++ || iterate backward and forward using std::bitset || fast (39ms, 100%?)
TODO(heder): Insert cute cat meme to ask for up-votes. ;)\n\n# Approach 1: using std::bitset\nSince the input range is so limited we can using a std::bitset to 
**TODO(heder): Insert cute cat meme to ask for up-votes. ;)**\n\n# Approach 1: using std::bitset\nSince the input range is so limited we can using a ```std::bitset``` to count unique elements instead of ```std::unordered_map```. With only 64bit wide the compiler can use ```popcount``` to count the number of set bits / unique elments.\n\n```cpp\n    static vector<int> distinctDifferenceArray(const vector<int>& nums) {\n        // scan backward\n        bitset<64> bw;\n        vector<int> cnt_bw(size(nums));\n        for (int i = size(nums) - 1; i >= 0; --i) {\n            cnt_bw[i] = bw.count();\n            bw.set(nums[i]);\n        }\n        // scan forward\n        bitset<64> fw;\n        vector<int> ans;\n        ans.reserve(size(nums));\n        for (int i = 0; i < size(nums); ++i) {\n            fw.set(nums[i]);\n            ans.push_back(fw.count() - cnt_bw[i]);\n        }\n        return ans;\n    }\n```\n\n**Complexity Analysis**\nLet $$n$$ be the lenght of the input then\n  * Time complexity is $$O(n)$$ as we need to scan it forward and backward and\n  * Space complexity is $$O(1)$$.\n\n_As always: Feedback, questions, and comments are welcome. Leaving an up-vote sparks joy! :)_\n\n**p.s. Join us on the [LeetCode The Hard Way Discord Server](https://discord.gg/hFUyVyWy2E)!**\n
['C']