# Top 10 Walmart Labs Coding Interview Questions from 2025


# Introduction
In this blog post, we'll share the most commonly asked coding interview questions at Walmart Labs.  If you don't have months to study for your interviews, you can use AI tools like [Chatmagic](https://www.chatmagic.app) to generate solutions quickly and efficiently - helping you pass the interviews and get the job offer!

	
# Problem #1: [Longest Substring Without Repeating Characters](https://leetcode.com/problems/longest-substring-without-repeating-characters)
> Given a string s, find the length of the longest substring without duplicate characters.   Example 1:  Input: s = "abcabcbb" Output: 3 Explanation: The answer is "abc", with the length of 3.  Example 2:  Input: s = "bbbbb" Output: 1 Explanation: The answer is "b", with the length of 1.  Example 3:  Input: s = "pwwkew" Output: 3 Explanation: The answer is "wke", with the length of 3. Notice that the answer must be a substring, "pwke" is a subsequence and not a substring.    Constraints:  0 <= s.length <= 5 * 104 s consists of English letters, digits, symbols and spaces.  

Topics: Hash Table, String, Sliding Window


# Problem #2: [Two Sum](https://leetcode.com/problems/two-sum)
> Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order.   Example 1:  Input: nums = [2,7,11,15], target = 9 Output: [0,1] Explanation: Because nums[0] + nums[1] == 9, we return [0, 1].  Example 2:  Input: nums = [3,2,4], target = 6 Output: [1,2]  Example 3:  Input: nums = [3,3], target = 6 Output: [0,1]    Constraints:  2 <= nums.length <= 104 -109 <= nums[i] <= 109 -109 <= target <= 109 Only one valid answer exists.    Follow-up: Can you come up with an algorithm that is less than O(n2) time complexity?

Topics: Array, Hash Table


# Problem #3: [Merge Intervals](https://leetcode.com/problems/merge-intervals)
> Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cover all the intervals in the input.   Example 1:  Input: intervals = [[1,3],[2,6],[8,10],[15,18]] Output: [[1,6],[8,10],[15,18]] Explanation: Since intervals [1,3] and [2,6] overlap, merge them into [1,6].  Example 2:  Input: intervals = [[1,4],[4,5]] Output: [[1,5]] Explanation: Intervals [1,4] and [4,5] are considered overlapping.    Constraints:  1 <= intervals.length <= 104 intervals[i].length == 2 0 <= starti <= endi <= 104  

Topics: Array, Sorting


# Problem #5: [Trapping Rain Water II](https://leetcode.com/problems/trapping-rain-water-ii)
> Given an m x n integer matrix heightMap representing the height of each unit cell in a 2D elevation map, return the volume of water it can trap after raining.   Example 1:   Input: heightMap = [[1,4,3,1,3,2],[3,2,1,3,2,4],[2,3,3,2,3,1]] Output: 4 Explanation: After the rain, water is trapped between the blocks. We have two small ponds 1 and 3 units trapped. The total volume of water trapped is 4.  Example 2:   Input: heightMap = [[3,3,3,3,3],[3,2,2,2,3],[3,2,1,2,3],[3,2,2,2,3],[3,3,3,3,3]] Output: 10    Constraints:  m == heightMap.length n == heightMap[i].length 1 <= m, n <= 200 0 <= heightMap[i][j] <= 2 * 104  

Topics: Array, Breadth-First Search, Heap (Priority Queue), Matrix


# Problem #6: [LRU Cache](https://leetcode.com/problems/lru-cache)
> Design a data structure that follows the constraints of a Least Recently Used (LRU) cache. Implement the LRUCache class:  LRUCache(int capacity) Initialize the LRU cache with positive size capacity. int get(int key) Return the value of the key if the key exists, otherwise return -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.  The functions get and put must each run in O(1) average time complexity.   Example 1:  Input ["LRUCache", "put", "put", "get", "put", "get", "put", "get", "get", "get"] [[2], [1, 1], [2, 2], [1], [3, 3], [2], [4, 4], [1], [3], [4]] Output [null, null, null, 1, null, -1, null, -1, 3, 4]  Explanation LRUCache lRUCache = new LRUCache(2); lRUCache.put(1, 1); // cache is {1=1} lRUCache.put(2, 2); // cache is {1=1, 2=2} lRUCache.get(1);    // return 1 lRUCache.put(3, 3); // LRU key was 2, evicts key 2, cache is {1=1, 3=3} lRUCache.get(2);    // returns -1 (not found) lRUCache.put(4, 4); // LRU key was 1, evicts key 1, cache is {4=4, 3=3} lRUCache.get(1);    // return -1 (not found) lRUCache.get(3);    // return 3 lRUCache.get(4);    // return 4    Constraints:  1 <= capacity <= 3000 0 <= key <= 104 0 <= value <= 105 At most 2 * 105 calls will be made to get and put.  

Topics: Hash Table, Linked List, Design, Doubly-Linked List


# Problem #7: [Valid Parentheses](https://leetcode.com/problems/valid-parentheses)
> Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if:  Open brackets must be closed by the same type of brackets. Open brackets must be closed in the correct order. Every close bracket has a corresponding open bracket of the same type.    Example 1:  Input: s = "()" Output: true  Example 2:  Input: s = "()[]{}" Output: true  Example 3:  Input: s = "(]" Output: false  Example 4:  Input: s = "([])" Output: true    Constraints:  1 <= s.length <= 104 s consists of parentheses only '()[]{}'.  

Topics: String, Stack


# Problem #8: [Median of Two Sorted Arrays](https://leetcode.com/problems/median-of-two-sorted-arrays)
> Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).   Example 1:  Input: nums1 = [1,3], nums2 = [2] Output: 2.00000 Explanation: merged array = [1,2,3] and median is 2.  Example 2:  Input: nums1 = [1,2], nums2 = [3,4] Output: 2.50000 Explanation: merged array = [1,2,3,4] and median is (2 + 3) / 2 = 2.5.    Constraints:  nums1.length == m nums2.length == n 0 <= m <= 1000 0 <= n <= 1000 1 <= m + n <= 2000 -106 <= nums1[i], nums2[i] <= 106  

Topics: Array, Binary Search, Divide and Conquer


# Problem #9: [Longest Palindromic Substring](https://leetcode.com/problems/longest-palindromic-substring)
> Given a string s, return the longest palindromic substring in s.   Example 1:  Input: s = "babad" Output: "bab" Explanation: "aba" is also a valid answer.  Example 2:  Input: s = "cbbd" Output: "bb"    Constraints:  1 <= s.length <= 1000 s consist of only digits and English letters.  

Topics: Two Pointers, String, Dynamic Programming


