Implement a LRU Cache
Design and implement a data structure for Least Recently Used (LRU) cache. It should support get and put operations in O(1) time.
Data structures questions covering arrays, trees, graphs, hash tables, heaps, and their real-world applications.
5
Questions in database
Design and implement a data structure for Least Recently Used (LRU) cache. It should support get and put operations in O(1) time.
Given a binary tree, return the level order traversal of its nodes values (i.e., from left to right, level by level).
Given two sorted arrays nums1 and nums2, return the median of the two sorted arrays. The overall run time complexity should be O(log(m+n)).
Given the head of a singly linked list, reverse the list and return the reversed list. Implement both iterative and recursive solutions.
Implement a trie data structure with insert, search, and autocomplete functionality. Optimize for prefix searches.