Walmart Interview Experience | 3 years experienced (SDE- 3)

Round 1:

-You are given some blocks resting on ground. So you have array like : 1, 2, 3, 4 now at each index it depicts no of blocks resting on it. Now gravity direction is changed from top to down to right to left what will be the final state of blocks in this array. So final state will be 4, 3, 2, 1.

Problem if analysed properly was actually a simple sorting problem. He asked some follow up questions on criteria on which we select any sorting algorithms (stable, in-place etc.).

-You are given an array of linked lists. Some of these lists are intersecting linked lists (having common nodes and then merging to one). So for example if there is a list of four nodes at 0th index it’s possible there is another list at some other index, say 1st index whose nodes merges to any of the nodes in 0th list. So find the number of connected groups in this structure. I used Disjoint set data structure to solve this problem.



Round 2:

Discussion on projects
Check if a given expression is valid or not. For example ((A+B/C)*(D-F)) is valid. And )*A+B) is not.
Discussion around Api url formats and various rest verbs
Discussion around various testing strategies (Unit, Smoke, Integration, API automations etc..).

Round 3:

This was a bar raiser round.

Q1: You are given size of a line line of people, say n and these n people can stand in any order and all of these n folks has distinct heights. Now from either end of the line you can see say p and q folks. Now here it’s possible some of the short height folks may be hidden behind taller folks.
For a given n, p and q find how many arrangements of all people is possible.

Q2: Preorder traversal recursive and iterative approach

Q3: Puzzle given numbers (8, 8, 3, 3) you need to form 24 using all these number once. You can use any operators(cube, cuberoot, factorial, +, -, *, /, %)
Also while using cube or cuberoot u are actually consuming one 3.
Answer was (cuberoot(8)+cuberoot(8))!

Q4: permutation of string



Q5: there are three person in a room say P1, P2, P3 all these people have some salaries say S1, S2 and S3. Now no person is willing to share his salary directly or indirectly from which individual salary can be deduced. You need to find a way to directly find the sun of salaries of all 3 folks.

Answer was to use randomisation. Each person will generate a random number and pass sum of his salary and random number to next. And so on once we have sum of all salaries and random numbers each person can subtract generated random numbers and deduce the sum of salaries from it.

Q6: Given a histogram having bars of width 1 unit and varying height, find the maximum area of a rectangle that can be formed within bar. (Rectangle formed should be contained inside bars).

 

Write your Interview Experience or mail it to contribute@geeksforgeeks.org

My Personal Notes arrow_drop_up

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.