🛒 Walmart DSA Interview Questions (with Links + Sources)

Posted
30 Aug 2025
600 reads

Summary

I've compiled a comprehensive list of Data Structures & Algorithms (DSA) interview questions that have been asked at Walmart, sourcing them from various interview experiences. This collection includes direct LeetCode links and aims to provide valuable insight into the technical problem-solving skills expected by the company.

How it went

I've meticulously collected and organized these interview questions to offer a detailed overview of what to expect in Walmart's technical rounds. This compilation aggregates problems reported by candidates across a spectrum of roles and experience levels, including SDE III, Senior SWE, and fresher positions. Some of the sources even specify locations like Bengaluru and recent interview dates up to December 2024. Each question is accompanied by its direct LeetCode link, facilitating easy access to the problem statement for focused practice. While the specific outcomes for all individual aggregated experiences are not universally detailed, one notable source explicitly mentions an offer, highlighting the relevance of these problems in successful interview journeys.

Questions asked (17)

  1. 01

    Move Zeroes

    Data Structures & Algorithms · Easy

    Given an integer array nums, move all 0's to the end of it while maintaining the relative order of the non-zero elements. Note that you must do this in-place without making a copy of the array.

    Open the problem
  2. 02

    Maximum Subarray

    Data Structures & Algorithms · Medium

    Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.

    Open the problem
  3. 03

    House Robber II

    Data Structures & Algorithms · Medium

    You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses are arranged in a circle. That means the first house is the neighbor of the last one. Meanwhile, adjacent houses have a security system connected, and it will automatically contact the police if two adjacent houses were broken into on the same night.

    Given an integer array nums representing the amount of money of each house, return the maximum amount of money you can rob tonight without alerting the police.

    Open the problem
  4. 04

    Subarray Sum Equals K

    Data Structures & Algorithms · Medium

    Given an array of integers nums and an integer k, return the total number of continuous subarrays whose sum equals to k.

    Open the problem
  5. 05

    LFU Cache

    Data Structures & Algorithms · Hard

    Design and implement a data structure for a Least Frequently Used (LFU) cache. Implement the LFUCache class:

    • LFUCache(int capacity) Initializes the object with the capacity of the data structure.
    • int get(int key) Gets the value of the key if the key exists in the cache, otherwise returns -1.
    • void put(int key, int value) Update the value of the key if present, or inserts the key if not already present. When the cache reaches its capacity, it should invalidate the least frequently used item before inserting a new item. For this problem, when there is a tie (a key has the same frequency as another key), the least recently used key would be invalidated.
    Open the problem
  6. 06

    LRU Cache

    Data Structures & Algorithms · Medium

    Design a data structure that follows the constraints of a Least Recently Used (LRU) cache.

    Implement the LRUCache class:

    • LRUCache(int capacity) Initializes the LRU cache with the given positive capacity.
    • int get(int key) Returns the value of the key if the key exists, otherwise returns -1.
    • void put(int key, int value) Update the value of the key if the key exists, Otherwise, add the key-value pair to the cache. If the number of keys exceeds the capacity from this operation, evict the least recently used key.
    Open the problem
  7. 07

    Degree of an Array

    Data Structures & Algorithms · Easy

    Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements. Your task is to find the smallest possible length of a (contiguous) subarray of nums that has the same degree as nums.

    Open the problem
  8. 08

    Reformat Date

    Data Structures & Algorithms · Easy

    Given a date string in the form "Day Month Year", where:

    • Day is an integer in the range [1, 31] with an ordinal suffix.
    • Month is a three-letter abbreviation of a month.
    • Year is an integer in the range [1900, 2100].

    Return the date in the format "YYYY-MM-DD".

    Open the problem
  9. 09

    Two Sum IV - Input is a BST

    Data Structures & Algorithms · Easy

    Given the root of a Binary Search Tree and an integer k, return true if there exist two distinct nodes in the tree whose values sum up to k, or false otherwise.

    Open the problem
  10. 10

    Gas Station

    Data Structures & Algorithms · Medium

    There are n gas stations along a circular route, where the amount of gas at the ith station is gas[i]. You have a car with an unlimited tank and it costs cost[i] of gas to travel from the ith station to the (i + 1)th station. You begin the journey with an empty tank at one of the gas stations.

    Given two integer arrays gas and cost, return the starting gas station's index if you can travel around the circuit once in the clockwise direction, otherwise return -1. If there exists a solution, it is guaranteed to be unique.

    Open the problem
  11. 11

    Jump Game

    Data Structures & Algorithms · Medium

    You are given an integer array nums. You are initially positioned at the array's first index, and each element in nums represents your maximum jump length at that position.

    Return true if you can reach the last index, or false otherwise.

    Open the problem
  12. 12

    Subsets II

    Data Structures & Algorithms · Medium

    Given an integer array nums that may contain duplicates, return all possible subsets (the power set).

    The solution set must not contain duplicate subsets. Return the solution in any order.

    Open the problem
  13. 13

    Longest Palindromic Substring

    Data Structures & Algorithms · Medium

    Given a string s, return the longest palindromic substring in s.

    Open the problem
  14. 14

    Reverse Linked List

    Data Structures & Algorithms · Easy

    Given the head of a singly linked list, reverse the list, and return the reversed list.

    Open the problem
  15. 15

    Minimum Number of Days to Make m Bouquets

    Data Structures & Algorithms · Medium

    You are given an integer array bloomDay, an integer m and an integer k.

    You want to make m bouquets. To make a bouquet, you need k adjacent flowers from the garden. The garden has n flowers, the ith flower will bloom in the bloomDay[i] and then can be used in exactly one bouquet.

    Return the minimum number of days you need to wait to be able to make m bouquets. If it is impossible to make m bouquets, return -1.

    Open the problem
  16. 16

    Best Time to Buy and Sell Stock with Cooldown

    Data Structures & Algorithms · Medium

    You are given an array prices where prices[i] is the price of a given stock on the ith day.

    Find the maximum profit you can achieve. You may complete as many transactions as you like (i.e., buy one and sell one share of the stock multiple times) with the following restrictions:

    • You may not engage in multiple transactions simultaneously (i.e., you must sell the stock before you buy again).
    • After you sell your stock, you cannot buy stock on the next day (i.e., cooldown period is one day).
    Open the problem
  17. 17

    Trapping Rain Water

    Data Structures & Algorithms · Hard

    Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining.

    Open the problem

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Walmart recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

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