Walmart Interview

walmart logo
walmart
November 12, 202423 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:

  1. return oldest element
  2. return newest element
  3. return min
  4. return max
  5. fetch and remove oldest element
  6. fetch and remove newest element
Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!