Walmart interview experience Real time questions & tips from candidates to crack your interview

SWE-2

Walmart
upvote
share-icon
4 rounds | 6 Coding problems

Interview preparation journey

expand-icon
Journey
Starting my software engineering career with a solid foundation in C++, I quickly realized the need to expand my skill set. I delved deeply into algorithms and data structures, spending countless hours on coding platforms. However, I knew that advancing to a SWE-2 role required more than just problem-solving skills. I began exploring backend development, learning Python and Go, and working on side projects such as a web-based task management tool. These projects not only strengthened my technical abilities but also provided real-world experience in building scalable systems.
Application story
Walmart visited my campus during placement season, presenting a great opportunity to apply for the SWE-2 role. I submitted my application through my college's placement portal, where we were required to upload our resumes and complete an online form.
Why selected/rejected for the role?
I was rejected for this role because, in my final hiring manager round, they asked me a difficult puzzle that I was unable to solve. I became quite nervous and made a couple of mistakes.
Preparation
Duration: 1 month
Topics: Data Structures, Algorithms, OOPS, Design Patterns, System Design
Tip
Tip

Tip 1: Practice at least 4-5 questions daily.

Tip 2: Prepare a good script for your projects.

Application process
Where: Campus
Eligibility: Above 7 CGPA
Resume Tip
Resume tip

Tip 1: Have 2-3 strong projects.

Tip 2: List only those skills in which you are confident.

Interview rounds

01
Round
Medium
Online Coding Interview
Duration90 minutes
Interview date16 Jul 2022
Coding problem2

1. K Most Frequent Elements

Moderate
10m average time
85% success
0/80
Asked in companies
FacebookOracleAmazon

Given an integer array nums[] and an integer k, return the k most frequent elements in the array.

Problem approach

Step 1: Initially, I thought of sorting the array based on frequency and then selecting the top k elements. But sorting would take O(n log n) time, which wasn’t ideal.
Step 2: To optimize, I used a hash map to count the frequency of each element, and then a min-heap to keep track of the top k frequent elements. This reduced the time complexity to O(n log k).
Step 3: I implemented this approach in the online assessment, which efficiently passed all test cases.

Try solving now

2. Maximum sum of non-adjacent elements

Moderate
15m average time
85% success
0/80
Asked in companies
MakeMyTripSalesforceExpedia Group

You are given an array/list of ‘N’ integers. You are supposed to return the maximum sum of the subsequence with the constraint that no two elements are adjacent in the given array/list.

Note:
A subsequence of an array/list is obtained by deleting some number of elements (can be zero) from the array/list, leaving the remaining elements in their original order.
Problem approach

Step 1: I started by thinking about a recursive solution where I would decide for each element whether to include it in the subsequence or not, but this approach would result in exponential time complexity, O(2^n), due to the overlapping subproblems.
Step 2: To optimize, I transformed the problem into a dynamic programming problem where I maintained an array dp[] where dp[i] represented the maximum sum of subsequences considering the first i elements.
Step 3: The recurrence relation I used was dp[i] = max(dp[i-1], arr[i] + dp[i-2]). The idea was to either include the current element and add it to the sum excluding the previous one, or to exclude the current element and carry forward the previous maximum sum. The solution had a time complexity of O(n) and a space complexity of O(n), and passed all test cases during the assessment.

Try solving now
02
Round
Medium
Video Call
Duration45 minutes
Interview date17 Jul 2022
Coding problem1

1. Coin Change(Finite Supply)

Hard
0/120
Asked in companies
IBMAdobeAmazon

You are given an array of integers ‘coins’ denoting the denomination of coins and another array of integers ‘freq’ denoting the number of coins of each denomination.

You have to find the number of ways to make the sum ‘V’ by selecting some(or all) coins from the array.

The answer can be very large. So, return the answer modulo 1000000007.

For Example :
‘N’ = 3, ‘coins’ = {1, 2, 3}, ‘freq’ = {1, 1, 3}, ‘V’ = 6

For the given example, we can make six by using the following coins:
{1, 2, 3}
{3. 3}
Hence, the answer is 2.
Problem approach

Step 1: I started with a brute-force approach, where I would generate all possible combinations of coins and count the ones that sum up to the target amount. However, this approach was inefficient with a time complexity of O(2^n), especially for larger inputs.

Step 2: The interviewer asked if I could optimize the solution. I then switched to a dynamic programming approach. I defined a dp[] array where dp[i] represented the number of combinations that sum up to the amount i. The idea was to iteratively build up the number of combinations for increasing amounts.

Step 3: I used the recurrence relation: for each coin in coins[], I updated the dp[] array by adding dp[i - coin] to dp[i] for all amounts i from coin to amount. This efficiently counted the number of ways to form each amount. I initialized dp[0] = 1 since there is exactly one way to make the amount 0 (using no coins). The final time complexity of this solution was O(n * m), where n is the amount and m is the number of coins. The approach was effective and met the interviewer’s expectations.

Try solving now
03
Round
Hard
Video Call
Duration45 minutes
Interview date18 Jul 2022
Coding problem1

1. Find Minimum Number Of Coins

Easy
15m average time
85% success
0/40
Asked in companies
Goldman SachsMicrosoftAmazon

Given an infinite supply of Indian currency i.e. [1, 2, 5, 10, 20, 50, 100, 500, 1000] valued coins and an amount 'N'.


Find the minimum coins needed to make the sum equal to 'N'. You have to return the list containing the value of coins required in decreasing order.


For Example
For Amount = 70, the minimum number of coins required is 2 i.e an Rs. 50 coin and a Rs. 20 coin.
Note
It is always possible to find the minimum number of coins for the given amount. So, the answer will always exist.
Problem approach

Step 1: I started by understanding that this problem is a variation of the knapsack problem where we need to maximize the value of coins picked from multiple piles with the constraint of picking exactly k coins. The problem involves both optimization and combination aspects.

Step 2: The interviewer suggested using dynamic programming to solve this efficiently. I defined a DP table dp[j], where dp[j] represents the maximum total value of coins we can collect by picking exactly j coins.

Step 3: For each pile, I calculated the cumulative sum of coins from the top up to x coins. I then iteratively updated the DP table by considering each possible number of coins that could be picked from the current pile and updating the maximum values in dp[].

Step 4: Specifically, for each pile, I used a temporary array to store intermediate results and updated the DP table in a way that ensures previous results are used optimally. The final solution was obtained by processing each pile and updating the DP array according to the possible number of coins that could be picked from the pile.

Step 5: I ensured that the solution handles edge cases such as piles with fewer coins than k and large values of k. The approach had a time complexity of O(n * k^2) and efficiently calculated the maximum total value of coins. The solution was validated against various test cases during the interview.

Try solving now
04
Round
Medium
Video Call
Duration45 minutes
Interview date19 Jul 2022
Coding problem2

Hiring Manager Round

1. Puzzle

You went to a bank to cash your check. The bank clerk accidentally gives you: The dollar amount is in cents, and the cent amount is in dollars. You spend 5 cents on the way home and then realize you have twice the amount of your cheque. What was the actual amount that was written on the cheque?

2. System Design

Design a snake ladder game? (Learn)

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Skill covered: Programming

How do you remove whitespace from the start of a string?

Choose another skill to practice
Similar interview experiences
company logo
Database Administrator
4 rounds | 8 problems
Interviewed by Walmart
1193 views
1 comments
0 upvotes
company logo
Senior Software Engineer
3 rounds | 3 problems
Interviewed by Walmart
0 views
1 comments
0 upvotes
company logo
SDE-3
5 rounds | 7 problems
Interviewed by Walmart
3769 views
1 comments
0 upvotes
company logo
SDE-3
5 rounds | 7 problems
Interviewed by Walmart
3173 views
0 comments
0 upvotes