Amazon Applied Scientist 2 / Applied Scientist II
Anonymous User
5814

Interview consist of 3 rounds after phone screening.

Round 1 - ML Topics
Round 2 - Deep dive ML topics with past project
Round 3 - Coding, 2 Questions in 45 mins

Question 1: Create a stack with the following operations

  • top
  • pop
  • push
  • findMiddle
  • deleteMiddle

trick 1: Use combination of deque and stack.
trick 2: Use hashmap to store the middle along with doubly linked list as the main data strucutre. the middle element's value moves one step when two elements are added.

All the operations should be in O(1)

Question 2: Given a binary tree, make all the nodes None where the node as well as all it's children are zero.
Constraint: Should be done in O(n).
trick: store sum of nodes at the node using dfs, in next iteration remove those nodes

Comments (8)