Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Amazon Interview Experience for SDE-1 | Off-Campus 2021

  • Last Updated : 12 Jan, 2022

Role: SDE1


Online Round: 2 Coding Question with Time Complexity Analysis

  1. Similar to nearest K coordinates from Origin. (Heap)
  2. Little bit of modification of 2-Sum, but I did in Brute Force way and it passed.

In the Last behavioural based MCQ Test.

After 5 days I got an email in which it mentioned that I will be having a quick connect with HR for Rounds Process.

Round 1:

  • Quick Intro
  • BST Iterator (Medium)
  • Basic Calculator (Hard)
  • I Solved both but for last one my code was not 100% complete as we were running out of time but I gave the approach and final Time Complexity.

Round 2:

  • Paint House[‘ladder’]&fromId=[’16’] (Premium on Leetcode, so attaching free Resource)
  • BFS on Grid, The question was like you are given 2D Matrix with 0,1 and a starting coordinate from that you have to cover all 1’s and tell how much minimum time it will take to do that and if any 1 is left return -1.

Round 3(Behavioural, taken by SDM III):

  • This Round was like brief Introduction, and that started with LP Questions
  • A Deadline you missed.
  • A Goal that you thought you will not be able to achieve but you did.
  • A most Challenging Task you did.
  • CS Fundamentals Questions, like difference between HTTP vs HTTPS, Thread vs Process, Memory Leak in Java, Classfull IP and its all Classes.
  • After about a week I got an email that I am having my Last Round Next Week.

Round 4:

  • A Small Introduction
  • LP Questions
  • 1 Coding Questions (Now for this I want to share that Interviewer itself was in doubt, the question was like you are given a Binary Tree with atmost 2 child and every child can have atmost 2 Parents, and you have to find a Maximum Path Sum from Root to Leaf)
  • I asked what is the structure of that Node, So he said what you think. I wrote this:
  • Java

    class Node
    int data;
    Node left;
    Node right


  • So he said Yes this is, (Now I was confused how come this can have links with Parent, maybe I am not able to get!)
  • Sample Test Case:


               /      \

            2         3

           /   \       /  \

         4       5        6

    O/P: [1,3,6]
  • So, 1st Solution that I gave was normal dfs based that I try every path from root till every Leaf and in that method I take current_sum and one global_sum and update it accordingly.
  • Java

    int ans = 0;
    List<Integer> finalAns;
    private void dfs(TreeNode root, int csum, List<Integer> ds)
    if(root==null) return;
    if(root.left==null && root.right==null)
     if(csum > ans)
      ans = csum;
      finalAns = ds;
    pubic List<Integer> solve(TreeNode root)
    this.ans = 0;
    this.finalAns = new ArrayList<Integer>();
    this.dfs(root,0,new ArrayList<Integer>());
    return this.finalAns;


  • Time Complexity: O(more than N) I was not able to figure out but it is I guess O(N^2)
  • So, he told me to optimise it I told him that I will do something Post Order type Traversal and from left and right I will bring answer. But he told me that this will not work, So I was not able to find something better.

Conclusion: Be Confident in LP Questions, discuss Brute Force first.

Verdict: Rejected

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!