All Oone Data Structure - C++ Solution @ LeetCode
All Oone Data Structure, is a LeetCode problem. In this post we will see how we can solve this challenge in C++
Implement a data structure supporting the following operations:
Inc(Key) - Inserts a new key with value 1. Or increments an existing key by 1. Key is guaranteed to be a non-empty string. Dec(Key) - If Key's value is 1, remove it from the data structure. Otherwise decrements an existing key by 1. If the key does not exist, this function does nothing. Key is guaranteed to be a non-empty string. ....
You can find the full details of the problem All Oone Data Structure at LeetCode
Solution: Please check the main.cpp snippet for the solution.
This solution originally posted at: Github by @kamyu104