Showing 3 of 7 questions
Simulate a robot's movement on an infinite grid based on a sequence of commands and obstacles. Determine the square of the robot's final Euclidean distance from the origin.
#1. Walking Robot Simulation
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
Design a system to shorten long URLs into tiny URLs and then retrieve the original URL from the shortened version. You need to implement both encoding and decoding functionalities.
#3. Encode and Decode TinyURL