Amazon SDE-1 | New Grad 2022 | India | Feb 2022 | Round 1
Anonymous User
2833

Status: 4th year CSE student at Tier-2 college
Position: SDE1 at Amazon
Location: India
Date: Feb 15th 2022
Opportunity type: Offcampus

Round 1: 1st Technical Round

  1. Short Introduction

  2. Minimum operations needed to balance a parenthesis string. We can either insert a paranthesis or replace an existing one with another. Each operation costs 1 unit.

    Example: "))(((" , "(()(("

    I used a stack to keep track of all the unbalanced paranthesis like "))(" and count them. If the count is even then the answer is n/2 else (n/2) + 1.

  3. Given a binary tree and value V and level L, insert the values V at the Lth level of the tree in the same structure as the existing level L

    Example:

     	 1        Level 1
     	/ \
       2    3     Level 2
      /      \
     4        7   Level 3
    
      V = 10, L = 3
      
      Output:
    
     	  1        Level 1
     	 / \
        2    3     Level 2
       /      \
      10      10   Level 3
     /          \
     4           7 Level 4

    I did a level order traversal up to the L-1th level with my queue storing all the nodes in the Lth level. Then I inserted new nodes having values V and added their appropriate child node

Solved both questions, first one took me 20-25 minutes to code and explain. Second question also took me around the same time.

Round 2 experience:
https://leetcode.com/discuss/interview-experience/1925974/Amazon-SDE-1-or-New-Grad-2022-or-India-or-Apr-2022-or-Round-2

Comments (10)