Walmart Interview Experience for SDE-III (2022)
I applied via LinkedIn and Naukari.com. Not sure from where my resume got picked up but I got a call from HR.
Round 1 (DS Algorithm: 1 our): (1 coding question, enhancement to coding questions, discussion on java )
- Implement 2 methods :boolean addString(string), List<String> searchString(string)
- addString: adds that string to db
- search string will return List of string starting with that string
eg: add : XX, XXY, XXX, YYX and on search(X) --> [XX,XXY,XXX]
Expected Time Complexity: search –> O(1), add –> O(m) : m being the length of length of adding string
Solution: i implemented using map add(xx) : x -> [xx], xx -> [xx] || add(xxy) : x->[xx,xxy], xx-> [xx,xxy], xxy->[xxy] etc.
2. As an enhancement, I was asked to make the adding and searching case-insensitive. He then asked to make the application level design of the above approach (just asked for approach). –> he was expecting a singleton design pattern I think but I explained using global java variables. (he was okay with that)
3. some time was left so he asked around simple java string functions.
Round 2 (LLD: Low-Level-Design 45 min):
- I was asked to design a Hostel management system for a college. All the classes and links between them. I designed them using maps. He was expecting to use inheritance instead to make it more generic and reusable. so I made a few changes in design and added those. He was okay with that I guess.
Round 3 (DS Algorithm: 1 Hour): (2 coding questions, General discussions on various DS):
- Implement find number of Islands in a 2d array: https://www.geeksforgeeks.org/find-number-of-islands/, it’s amortized complexity analysis.
- Implement Print path in a tree: https://www.geeksforgeeks.org/given-a-binary-tree-print-all-root-to-leaf-paths/ it’s complexity analysis.
- some time was left so she started asking questions like:
- what is the e of BST over the normal binary tree
- where can u find real-world problems like finding the island question?
- where do u think we use BST in the real world.
- what are self-balancing trees and why do we need them. How AVL tree works.
- what is B-tree and where do we use them in the real world. and a few more till we had time.
Round 4 (Hiring Manager: 45 min):
- Started with a brief introduction and tech stack experience I am currently working on.
- It somehow went to “so what you are saying is J-unit coverage should be given less priority than new code development ?”,
- “how do you think that stash can show all the code smells?”,
- “When I say design pattern, what is the first thing that pops in your mind?”.
and many more questions and discussions. It was really fun.