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

12 Jan, 2022
Role: SDE1
Source: naukri.com
Online Round: 2 Coding Question with Time Complexity Analysis
Similar to nearest K coordinates from Origin. (Heap)Little bit of modification of 2-Sum, but I did in Brute Force way and it passed.
Similar to nearest K coordinates from Origin. (Heap)
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 https://leetcode.com/problems/binary-search-tree-iterator/ (Medium)
Basic Calculator https://leetcode.com/problems/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 https://www.lintcode.com/problem/515/?_from=[‘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:JavaJavaclass Node  {  int data;  Node left;  Node right  }
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:              1           /      \        2         3       /   \       /  \     4       5        6O/P: [1,3,6]
Sample Test Case:
              1
           /      \
        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.JavaJavaint 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;   }   return;  }  ds.add(root.val);  dfs(root.left,csum+root.val,ds);  dfs(root.right,csum+root.val,ds);  ds.remove(ds.size()-1)  }  pubic List<Integer> solve(TreeNode root)  {  this.ans = 0;  this.finalAns = new ArrayList<Integer>();  this.dfs(root,0,new ArrayList<Integer>());  return this.finalAns;  }
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;   }   return;  }  ds.add(root.val);  dfs(root.left,csum+root.val,ds);  dfs(root.right,csum+root.val,ds);  ds.remove(ds.size()-1)  }  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
Amazon
Off-Campus
Interview Experiences
Amazon
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Microsoft Interview Experience for Internship (Via Engage)
Amazon Interview Experience for SDE-1 (On-Campus)
Infosys Interview Experience for DSE - System Engineer | On-Campus 2022
Amazon Interview Experience for SDE-1
Directi Interview | Set 7 (Programming Questions)
Oracle Interview Experience | Set 69 (Application Engineer)
Amazon Interview Experience for SDE-1(Off-Campus)
Amazon Interview Experience for SDE1 (8 Months Experienced) 2022
Amazon Interview Experience (Off-Campus) 2022
Difference between ANN, CNN and RNN