Add office photos
Walmart logo
Employer?
Claim Account for FREE

Walmart

3.8
based on 2.5k Reviews
Video summary
Filter interviews by
Software Developer
Fresher
Experienced
Skills
Clear (1)

40+ Walmart Software Developer Interview Questions and Answers

Updated 28 Feb 2025

Q1. Nth Fibonacci Number Problem Statement

Given an integer 'N', the task is to compute the N'th Fibonacci number using matrix exponentiation. Implement and return the Fibonacci value for the provided 'N'.

Note:

Si...read more

Ans.

Use matrix exponentiation to efficiently compute the Nth Fibonacci number modulo 10^9 + 7.

  • Implement matrix exponentiation to calculate Fibonacci numbers efficiently.

  • Use the formula F(n) = F(n-1) + F(n-2) with initial values F(1) = F(2) = 1.

  • Return the result modulo 10^9 + 7 to handle large Fibonacci numbers.

  • Optimize the solution to achieve better than O(N) time complexity.

Add your answer
right arrow

Q2. Make All Elements of the Array Distinct

Given an array/list ARR of integers with size 'N', your task is to determine the minimum number of increments needed to make all elements of the array distinct. You are a...read more

Ans.

Find the minimum number of increments needed to make all elements of the array distinct by increasing any element by 1 in each operation.

  • Iterate through the array and keep track of the frequency of each element.

  • For each element with frequency greater than 1, increment it until it becomes distinct.

  • Return the total number of operations needed to make all elements distinct.

Add your answer
right arrow
Walmart Software Developer Interview Questions and Answers for Freshers
illustration image

Q3. Encode the Message Problem Statement

Given a text message, your task is to return the Run-length Encoding of the given message.

Run-length encoding is a fast and simple method of encoding strings, representing ...read more

Ans.

Implement a function to encode a text message using run-length encoding.

  • Iterate through the message and count consecutive characters

  • Append the character and its count to the encoded message

  • Handle edge cases like single characters or empty message

Add your answer
right arrow

Q4. Minimum Cost to Buy Oranges Problem Statement

You are given a bag of capacity 'W' kg and a list 'cost' of costs for packets of oranges with different weights. Each element at the i-th position in the list indic...read more

Ans.

Find the minimum cost to buy a specific weight of oranges given the cost of different weight packets.

  • Iterate through the list of costs and find the minimum cost to achieve the desired weight.

  • Keep track of the minimum cost for each weight up to the desired weight.

  • Handle cases where a specific weight packet is unavailable by setting the cost to infinity.

  • Return the minimum cost for the desired weight, or -1 if it is not possible to achieve that weight.

Add your answer
right arrow
Discover Walmart interview dos and don'ts from real experiences

Q5. Distinct Characters Problem Statement

Given a string STR, return all possible non-empty subsequences with distinct characters. The order of the strings returned is not important.

Example:

Input:
STR = "cbc"
Out...read more
Ans.

Return all possible non-empty subsequences with distinct characters from a given string.

  • Use a recursive approach to generate all possible subsequences with distinct characters.

  • Keep track of the characters used in each subsequence to ensure uniqueness.

  • Return the generated subsequences as an array of strings.

Add your answer
right arrow

Q6. Calculate Score of Balanced Parentheses

In this intellectual game, Ninja is provided with a string of balanced parentheses called STR. The aim is to calculate the score based on specific game rules. If Ninja wi...read more

Ans.

Calculate the score of a string of balanced parentheses based on specific game rules.

  • Iterate through the string and keep track of the score based on the rules provided

  • Use a stack to keep track of the scores of valid parentheses expressions

  • For each '()', increment the score by 1; for '(x)', double the score of x

  • Return the final computed score for the string

Add your answer
right arrow
Are these interview questions helpful?

Q7. Binary Tree Construction from Traversals Problem

Given the POSTORDER and PREORDER traversals of a binary tree, where the tree consists of N nodes with each node representing a distinct positive integer from '1'...read more

Ans.

Construct a binary tree from given POSTORDER and PREORDER traversals.

  • Use the first element in PREORDER as the root node

  • Find the root node in POSTORDER to divide the tree into left and right subtrees

  • Recursively construct left and right subtrees using the divided traversals

Add your answer
right arrow

Q8. Similar Strings Problem Statement

Determine whether two given strings, A and B, both of length N, are similar by returning a 1 if they are, otherwise return a 0.

Explanation:

String A is similar to string B if ...read more

Ans.

Determine if two strings are similar based on given conditions.

  • Check if the strings are equal first.

  • Then check if the strings can be divided into two halves with similar patterns.

  • Return 1 if the strings are similar, 0 otherwise.

Add your answer
right arrow
Share interview questions and help millions of jobseekers 🌟
man with laptop

Q9. Deepest Leaves Sum Problem Statement

Given a binary tree of integers, your task is to calculate the sum of all the leaf nodes present at the deepest level of this binary tree. If there are no such nodes, output...read more

Ans.

Calculate the sum of leaf nodes at the deepest level of a binary tree.

  • Traverse the binary tree to find the deepest level of leaf nodes.

  • Sum the leaf nodes at the deepest level.

  • Handle null nodes represented by -1.

  • Ensure the sum fits within a 32-bit integer.

Add your answer
right arrow

Q10. Data Structure with Insert, Delete, and GetRandom Operations

Design a data structure that supports four operations: insert an element, remove an element, search for an element, and get a random element. Each op...read more

Ans.

Design a data structure with insert, delete, search, and getRandom operations, all in constant time.

  • Use a combination of HashMap and ArrayList to achieve constant time operations.

  • For insert operation, add the element to the ArrayList and store its index in the HashMap.

  • For delete operation, swap the element to be deleted with the last element in the ArrayList, update the index in the HashMap, and then remove the last element.

  • For search operation, check if the element exists in...read more

Add your answer
right arrow

Q11. House Robber Problem Statement

Mr. X is a professional robber with a plan to rob houses arranged in a circular street. Each house has a certain amount of money hidden, separated by a security system that alerts...read more

Ans.

House Robber problem where a robber wants to maximize stolen money without robbing adjacent houses in a circular street.

  • Use dynamic programming to keep track of maximum stolen money at each house.

  • Consider two cases: either rob the current house and skip the next, or skip the current house.

  • Handle circular arrangement by considering the first and last houses separately.

  • Example: For arr[] = {2, 3, 2}, the output is 3. Rob house 2 as it gives maximum money without triggering alar...read more

Add your answer
right arrow

Q12. Maximum Sum Subsequence Problem Statement

Given an array of integers NUMS consisting of N integers and an integer K, determine the maximum sum of an increasing subsequence with exactly K elements.

Example:

Inpu...read more
Ans.

Find the maximum sum of an increasing subsequence with exactly K elements in an array of integers.

  • Iterate through the array and maintain a dynamic programming table to store the maximum sum of increasing subsequences ending at each index.

  • For each element, check all previous elements to find the increasing subsequence with maximum sum ending at that element.

  • Update the dynamic programming table with the maximum sum found so far.

  • Return the maximum sum of an increasing subsequenc...read more

Add your answer
right arrow

Q13. Consecutive Elements

Given an array arr of N non-negative integers, determine whether the array consists of consecutive numbers. Return true if they do, and false otherwise.

Input:

The first line of input conta...read more
Ans.

Check if an array of integers consists of consecutive numbers.

  • Iterate through the array and check if the absolute difference between consecutive elements is 1.

  • Sort the array and check if the elements are consecutive.

  • Use a set to store the elements and check if the size of the set is equal to the length of the array.

Add your answer
right arrow

Q14. LRU Cache Design Question

Design a data structure for a Least Recently Used (LRU) cache that supports the following operations:

1. get(key) - Return the value of the key if it exists in the cache; otherwise, re...read more

Ans.

Design a Least Recently Used (LRU) cache data structure that supports get and put operations with capacity constraint.

  • Implement a doubly linked list to maintain the order of keys based on their recent usage.

  • Use a hashmap to store key-value pairs for quick access.

  • When capacity is reached, evict the least recently used item before inserting a new item.

  • Update the position of a key in the linked list whenever it is accessed or updated.

Add your answer
right arrow

Q15. Kth Largest Element Problem Statement

Ninja enjoys working with numbers, and Alice challenges him to find the Kth largest value from a given list of numbers.

Input:

The first line contains an integer 'T', repre...read more
Ans.

Find the Kth largest element in a given list of numbers.

  • Sort the array in descending order.

  • Return the Kth element from the sorted array.

  • Handle multiple test cases efficiently.

Add your answer
right arrow

Q16. Minimum Numbers Required Problem Statement

Given an array 'ARR' consisting of N integers, along with two integers, 'SUM' and 'MAXVAL', you need to determine the minimum number of integers to be added to the arr...read more

Ans.

Determine the minimum number of integers to be added to an array to make its sum equal to a given value.

  • Iterate through the array and calculate the current sum.

  • Determine the difference between the target sum and the current sum.

  • Add the minimum number of integers within the range of -MAXVAL to MAXVAL to reach the target sum.

Add your answer
right arrow

Q17. Check Whether Binary Tree Is Complete

You have been given a binary tree and your task is to determine if it is a Complete Binary Tree or not.

A Complete Binary Tree is defined as a binary tree where every level...read more

Ans.

Check if a binary tree is a Complete Binary Tree or not based on given criteria.

  • Traverse the binary tree level by level and check if all levels are completely filled except the last one.

  • Ensure all nodes at the last level are positioned at the leftmost side.

  • Use level order traversal to check for completeness of the binary tree.

  • Example: For input 1 2 3 4 -1 5 6 -1 7 -1 -1 -1 -1 -1 -1, the output should be 1.

Add your answer
right arrow

Q18. Palindrome Permutation - Problem Statement

Determine if a permutation of a given string S can form a palindrome.

Example:

Input:
string S = "aab"
Output:
"True"
Explanation:

The permutation "aba" of the string ...read more

Ans.

Check if a permutation of a string can form a palindrome.

  • Create a frequency map of characters in the string.

  • Count the number of characters with odd frequencies.

  • If there is at most one character with odd frequency, return true.

  • Otherwise, return false.

Add your answer
right arrow

Q19. Word Presence in Sentence

Determine if a given word 'W' is present in the sentence 'S' as a complete word. The word should not merely be a substring of another word.

Input:

The first line contains an integer 'T...read more
Ans.

Check if a given word is present in a sentence as a complete word.

  • Split the sentence into words using spaces as delimiter.

  • Check if the given word matches any of the words in the sentence.

  • Ensure that the word is not just a substring of another word in the sentence.

Add your answer
right arrow

Q20. Intersection of Linked Lists Problem Statement

You are provided with two linked lists, L1 and L2, both sorted in ascending order. Generate a new linked list containing elements that exist in both linked lists, ...read more

Ans.

Given two sorted linked lists, find the intersection of elements in both lists and return a new sorted linked list.

  • Traverse both linked lists simultaneously to find common elements

  • Create a new linked list to store the intersecting elements

  • Ensure the final linked list is sorted in ascending order

  • Handle cases where there are no common elements between the lists

Add your answer
right arrow

Q21. K - Sum Path In A Binary Tree

Given a binary tree where each node contains an integer value, and a value 'K', your task is to find all the paths in the binary tree such that the sum of the node values in each p...read more

Ans.

Find all paths in a binary tree where the sum of node values equals a given value 'K'.

  • Traverse the binary tree using DFS and keep track of the current path and its sum.

  • At each node, check if the current sum equals 'K' and add the path to the result if true.

  • Continue traversal to the left and right child nodes recursively.

  • Return the list of paths that sum up to 'K'.

Add your answer
right arrow

Q22. Remove Consecutive Duplicates Problem Statement

Given a string str of size N, your task is to recursively remove consecutive duplicates from this string.

Input:

T (number of test cases)
N (length of the string f...read more
Ans.

Recursively remove consecutive duplicates from a given string.

  • Use recursion to check for consecutive duplicates in the string.

  • If current character is same as next character, skip the next character.

  • Repeat the process until no consecutive duplicates are found.

Add your answer
right arrow
Q23. Can you explain the concepts of static and dynamic polymorphism in Object-Oriented Programming?
Ans.

Static polymorphism is achieved at compile time through method overloading and overriding. Dynamic polymorphism is achieved at runtime through method overriding.

  • Static polymorphism is also known as compile-time polymorphism.

  • Dynamic polymorphism is also known as runtime polymorphism.

  • Static polymorphism is achieved through method overloading, where multiple methods have the same name but different parameters.

  • Dynamic polymorphism is achieved through method overriding, where a su...read more

Add your answer
right arrow
Q24. Why is Java considered platform-independent while the Java Virtual Machine (JVM) is platform-dependent?
Ans.

Java is platform-independent because the code is compiled into bytecode that can run on any platform with a JVM, which is platform-dependent due to its reliance on the underlying hardware and operating system.

  • Java code is compiled into bytecode, which can run on any platform with a JVM.

  • JVM acts as an interpreter that translates bytecode into machine code specific to the underlying hardware and operating system.

  • The JVM provides a layer of abstraction between the Java code and ...read more

Add your answer
right arrow
Q25. What are the advantages of using views in a database management system?
Ans.

Views in a database management system provide data security, simplify complex queries, and improve performance.

  • Enhanced security by restricting access to certain columns or rows

  • Simplify complex queries by pre-defining joins and filters

  • Reduce redundancy by storing commonly used queries as views

  • Improve performance by storing pre-processed data in views

  • Allow for data abstraction, making it easier to work with complex data structures

Add your answer
right arrow
Q26. You have two wires of different lengths that take different times to burn. How can you measure a specific amount of time using these two wires?
Ans.

Use two wires of different lengths to measure a specific amount of time by burning them simultaneously.

  • Burn both wires at the same time, one wire will burn faster than the other.

  • Measure the time it takes for the faster burning wire to completely burn.

  • Calculate the specific amount of time by using the ratio of the lengths of the two wires.

Add your answer
right arrow
Q27. You have 3 ants located at the corners of a triangle. The challenge is to determine the movement pattern of the ants if they all start moving towards each other. What will be the outcome?
Ans.

The ants will end up at the center of the triangle.

  • The ants will move towards each other in a straight line.

  • They will meet at the centroid of the triangle, which is the point where all three medians intersect.

  • The centroid is located at two-thirds of the distance from each vertex to the midpoint of the opposite side.

Add your answer
right arrow
Q28. How can you print numbers from 1 to 100 using more than two threads in an optimized approach?
Ans.

Use multiple threads to print numbers from 1 to 100 in an optimized approach.

  • Divide the range of numbers (1-100) among the threads to avoid duplication.

  • Use synchronization mechanisms like mutex or semaphore to ensure proper order of printing.

  • Consider using a shared data structure like a queue to coordinate the threads.

  • Implement a mechanism to signal the threads when to start and stop printing.

Add your answer
right arrow
Q29. Can you explain demand paging?
Ans.

Demand paging is a memory management technique where pages are loaded into memory only when they are needed.

  • Pages are loaded into memory on demand, rather than all at once.

  • Helps in reducing the amount of physical memory needed.

  • Improves overall system performance by allowing more processes to run simultaneously.

  • Commonly used in modern operating systems like Linux and Windows.

  • Example: When a program is executed, only the initial pages are loaded into memory. As the program prog...read more

Add your answer
right arrow

Q30. What is popular temple in ur village?

Ans.

The popular temple in my village is the Sri Ranganathaswamy Temple.

  • Located in the heart of the village

  • Dedicated to Lord Ranganatha

  • Annual festivals and rituals attract devotees from neighboring villages

Add your answer
right arrow
Q31. Design a Railway Reservation System.
Ans.

Design a Railway Reservation System

  • Create a database to store train schedules, seat availability, and passenger information

  • Implement a user interface for users to search for trains, book tickets, and view their reservations

  • Include features like seat selection, payment processing, and ticket confirmation

  • Handle scenarios like waitlisting, cancellations, and refunds

  • Ensure data security and privacy of passenger information

Add your answer
right arrow

Q32. Leetcode - smallest palindrome, Lowest common ancestor

Ans.

Find the smallest palindrome and lowest common ancestor in a given tree

  • To find the smallest palindrome, iterate through the string and check if it is a palindrome. Return the smallest one found.

  • To find the lowest common ancestor in a tree, use a recursive approach to traverse the tree and find the common ancestor of two nodes.

Add your answer
right arrow

Q33. What is ur strength ?

Ans.

My strength lies in my problem-solving skills and ability to learn quickly.

  • Strong problem-solving skills

  • Quick learner

  • Adaptability to new technologies

  • Ability to work well under pressure

Add your answer
right arrow

Q34. What can support you?

Ans.

Support from my team, access to resources, clear communication

  • Support from my team helps me stay motivated and overcome challenges

  • Access to resources such as training materials and tools enables me to perform my job effectively

  • Clear communication ensures that I understand project requirements and expectations

Add your answer
right arrow

Q35. How many languages do know?

Ans.

I am proficient in 5 programming languages including Java, Python, C++, JavaScript, and SQL.

  • Java

  • Python

  • C++

  • JavaScript

  • SQL

Add your answer
right arrow

Q36. Explain about ur SCC ?

Ans.

SCC stands for Source Code Control. It is a system used to manage and track changes to source code files.

  • SCC helps developers collaborate on code by providing version control and tracking changes.

  • Popular SCC tools include Git, SVN, and Mercurial.

  • SCC allows developers to revert to previous versions of code, track changes made by team members, and merge code changes seamlessly.

  • SCC helps in maintaining code integrity and ensuring that the latest version of code is always availab...read more

View 1 answer
right arrow

Q37. Take home project, with APIs fetch etc.

Ans.

Develop a take home project involving fetching data from APIs

  • Create a project that fetches data from a public API such as weather forecast or news articles

  • Use libraries like Axios or Fetch API to make API calls

  • Display the fetched data in a user-friendly interface

  • Implement error handling for failed API calls

Add your answer
right arrow

Q38. Explain about intermediate ?

Ans.

Intermediate refers to a level of proficiency or knowledge that falls between beginner and advanced.

  • Intermediate level typically involves a deeper understanding of concepts and the ability to apply them in practical scenarios.

  • Individuals at an intermediate level may have some experience in the field but still have room for growth and learning.

  • Examples of intermediate skills include proficiency in a programming language, familiarity with common algorithms, and ability to work ...read more

Add your answer
right arrow

Q39. System design on web applications

Ans.

System design on web applications involves planning and organizing the architecture, components, and interactions of the system.

  • Understand the requirements and constraints of the web application

  • Identify the components and modules needed for the system

  • Design the architecture including front-end, back-end, and database

  • Consider scalability, security, and performance

  • Use appropriate technologies and frameworks

  • Implement testing and monitoring strategies

Add your answer
right arrow

Q40. Search engine system design

Ans.

Designing a search engine system involves creating algorithms for indexing, ranking, and retrieving relevant information.

  • Consider using inverted index for efficient searching

  • Implement ranking algorithms like PageRank or TF-IDF

  • Utilize web crawlers to gather and index web pages

  • Include features like autocomplete and spell correction for user-friendly experience

Add your answer
right arrow
Contribute & help others!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos

Interview Process at Walmart Software Developer

based on 16 interviews
4 Interview rounds
Coding Test Round
Technical Round
HR Round - 1
HR Round - 2
View more
interview tips and stories logo
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Software Developer Interview Questions from Similar Companies

TCS Logo
3.7
 • 245 Interview Questions
Deloitte Logo
3.8
 • 45 Interview Questions
TCS iON Logo
3.9
 • 35 Interview Questions
Facebook Logo
4.3
 • 25 Interview Questions
Dell Logo
4.0
 • 19 Interview Questions
Mobikwik Logo
3.7
 • 17 Interview Questions
View all
Recently Viewed
PHOTOS
Growisto
7 office photos
JOBS
GroundTruth
33 jobs
JOBS
Browse jobs
Discover jobs you love
JOBS
Gushwork
14 jobs
REVIEWS
Walmart
No Reviews
SALARIES
Walmart
SALARIES
Walmart
REVIEWS
Walmart
No Reviews
REVIEWS
Ravindra Bharathi Schools
No Reviews
SALARIES
Walmart
Share an Interview
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
75 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter