15.4 Exercises
Basic Difficulty
1135. Connecting Cities With Minimum Cost
Solve this problem again using union-find and Kruskal’s Algorithm.
Advanced Difficulty
432. All O`one Data Structure
Design a data structure that supports increaseKey, decreaseKey, getMaxKey, and getMinKey, all in time complexity.
716. Max Stack
Design a stack that supports push, pop, top, getMax, and popMax. You can use a method similar to LRU to reduce time complexity, but since we need to get the maximum value, which data structure should replace the unordered_map?