Round 2: Coding (1 hr.)
- Introduction and Leadership Principles: We started with introductions, followed by a couple of leadership questions like give a situation where you aimed for long term goal rather than short term.
Question 1:
Given a matrix containing blue and white balloons, where on any given day, all the white balloons surrounding the blue ones in four directions (up, down, left, right) are converted to blue ones. Return the minimum number of days required to convert all balloons to blue.
Follow up:
How to get the number of blue balloons at any given day (0 to MAX_DAY)
Input:
W W W W
W W B W
W W W W
B W W W
Output: 3
Explanation:
Day 1:
W W B W
W B B B
B W B W
B B W W
Day 2:
W B B B
B B B B
B B B B
B B B W
Day 3:
B B B B
B B B B
B B B B
B B B B
Approach: BFS
Question 2:
- Amazon Provides a locker service for packages
- Design a function which returns the locker to be open when a package is received
- Design a function to retrieve the package of a given customer
For simplicity, assume packages can be of 3 sizes: small, medium and large.
Verbally discussed the algorithm and data structures due to lack of time.