Object-Oriented Programming · LinkedIn · Medium
Your response MUST be in English and MUST NOT contain Chinese characters. Implement a class that supports the following operations in O(1) time complexity: add(val), remove(val), and removeRandom(). Assume all operations are valid — for example, remove and removeRandom will never be called on an empty collection. Example operation sequence: After this sequence, the remaining value may be [1].
Checking your access…