1. LRU Cache Implementation
Design and implement an LRU (Least Recently Used) cache. This cache should support the following operations: get and put.
- get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1.
- put(key, value) - Set or insert the value if the key is not already present. When the cache reached its capacity, it should invalidate the least recently used item before inserting a new item.
Discuss the data structures you would use to implement this cache and explain why. Also, analyze the time complexity of each operation.
2. Implement a Poker Class
Design and implement a poker class with the following functionalities: 1. Distribute the remaining cards to 'n' players (e.g., if there are 17 cards and 5 players, each player gets 3 cards and 2 cards remain). 2. Calculate which player currently holds the highest score based on the cards in hand.
3. Design a report system
Design a report system that generates log with some inputs, including considerations for the front end, backend, and performance.