Showing 3 questions
You're given a pile of stones with different weights. In each turn, you smash the two heaviest stones together, and the goal is to find the weight of the last remaining stone (or zero if no stone remains).
#1. Last Stone Weight
Design a data structure that acts as a Least Recently Used (LRU) cache. Implement methods to get and put key-value pairs, evicting the least recently used entry when the cache is full.
#2. LRU Cache
Given a list of words, group together all the anagrams. Anagrams are words that contain the same letters rearranged.
#3. Group Anagrams