TikTok Interview Question

data structure design with O(1) complexity.