Walmart
More Experiences
Walmart Interview
November 12, 2024 • 23 reads
Summary
I recently interviewed at Walmart, where the focus was on designing a data structure for O(1) time complexity operations like returning min/max and handling oldest/newest elements.
Full Experience
I had an interview at Walmart that centered around a challenging data structure design problem. I was asked to implement a data structure capable of performing several operations—specifically, returning the oldest, newest, minimum, and maximum elements, as well as fetching and removing the oldest and newest elements—all with a strict O(1) time complexity requirement.
Interview Questions (1)
Q1
Design Data Structure for O(1) Min/Max/Oldest/Newest
Data Structures & Algorithms
Design a datastructure which can perform following operations with O(1) time complexity:
- return oldest element
- return newest element
- return min
- return max
- fetch and remove oldest element
- fetch and remove newest element