Walmart Labs
Patel Infrastructure Interview Questions and Answers
Q1. how to find number of paths in tree such that sum of the values in those nodes will be equal to count?(hint:recursion)
Finding number of paths in tree with sum of node values equal to count using recursion.
Use recursion to traverse the tree and keep track of the sum of node values.
At each node, check if the current sum equals the desired count.
If yes, increment the path count.
Recursively traverse the left and right subtrees.
Return the total path count.
Example: Given a tree with values [10, 5, -3, 3, 2, null, 11], count the number of paths with sum equal to 8.
The answer would be 3, as there ar...read more
Q2. There is 3*3 RUBIX cube, Can you find data structure for solving rubix cube
A graph data structure can be used to solve a Rubix cube.
Each cubelet can be represented as a node in the graph.
Edges can be added between nodes to represent possible moves.
A search algorithm like BFS or DFS can be used to find the solution.
Q3. If Redo and Undo operations have to perform, which datastructure can we use?(stack)
Stack data structure is suitable for implementing Redo and Undo operations.
Stack follows Last-In-First-Out (LIFO) order, which is ideal for undoing and redoing operations.
When an operation is performed, it can be pushed onto the stack for undoing later.
To redo an operation, the previously undone operations can be popped from the stack.
Stack provides efficient insertion and deletion at one end, making it suitable for undo and redo functionality.
Q4. Given array of weights(infinite supply), can you find that given weight can be formed by using those set of weights?(dynamic programming,geeksforgeeks)
Dynamic programming solution to find if a given weight can be formed using an array of weights
Create a boolean array of size (given weight + 1) to store if a weight can be formed or not
Initialize the first element of the boolean array to true
Iterate through the array of weights and for each weight, iterate through the boolean array and mark true for all weights that can be formed using the current weight
Return the value at the index of the given weight in the boolean array
Q5. Can you explain me about Router ?
A router is a networking device that forwards data packets between computer networks.
Routers operate at the network layer of the OSI model.
They use routing tables to determine the best path for data packets to travel.
Routers can connect multiple networks together, such as a home network to the internet.
They can also provide security by blocking unauthorized access to a network.
Examples of routers include Cisco, Netgear, and TP-Link.
Q6. one simple puzzle?(cant explain through words)
Arrange 8 queens on a chessboard so that no two queens threaten each other.
Each queen must be placed in a different row and column
No two queens can be in the same diagonal
There are 92 possible solutions
One solution is: (0, 4), (1, 2), (2, 7), (3, 3), (4, 6), (5, 1), (6, 5), (7, 0)
Q7. Explain about how internet works?
The internet is a global network of interconnected devices that communicate with each other using standardized protocols.
The internet is made up of millions of interconnected devices such as computers, servers, routers, and switches.
Data is transmitted across the internet using standardized protocols such as TCP/IP.
The internet is accessed through Internet Service Providers (ISPs) who provide users with a connection to the internet.
Websites are hosted on servers and accessed ...read more
Q8. Find the subarray with given sum.
Find subarray with given sum in an array of integers.
Use a sliding window approach to find subarray with sum equal to given sum.
Keep track of current sum and adjust window size accordingly.
Return the indices of the subarray if found, else return an empty array.
Q9. Reverse a linkedlist, sorting algorithms
Reverse a linked list and discuss sorting algorithms.
To reverse a linked list, you can use a three-pointer approach.
Sorting algorithms include bubble sort, insertion sort, merge sort, quicksort, etc.
Discuss the time complexity and space complexity of each sorting algorithm.
Provide examples of how each sorting algorithm works.
Interview Process at Patel Infrastructure
Top Software Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month