Amazon | Campus Technical Interview Experience
- Posted
- 22 Aug 2021
Summary
I participated in the Amazon campus technical interviews, which comprised multiple challenging rounds. The interviews heavily focused on data structures and algorithms, covering a diverse set of problems across different complexities.
How it went
During my Amazon campus technical interview experience, the process involved several rounds designed to assess problem-solving capabilities. From what I recall and gathered from other students, we encountered a wide range of algorithmic challenges. In one round, I remember tackling questions like finding the largest BST subtree in a binary tree and determining if an array could be divided into pairs whose sum is divisible by a given 'k'. Another round featured the classic Knight's Tour problem, a challenging backtracking exercise, alongside a more straightforward task like finding the second largest element in an array and flattening a binary tree. Later rounds continued this trend, with problems such as maximizing profit from stock transactions, handling median calculations in a stream of integers, and finding previous permutations. The interviewers also explored advanced tree concepts like the Lowest Common Ancestor in an N-ary tree and dynamic programming challenges like 'Uncrossed Lines'.
Questions asked (10)
- 01
Largest BST Subtree
Data Structures & Algorithms · Hard
Given a binary tree, find the largest subtree that is also a binary search tree (BST) and return the size of the subtree.
- 02
Check if Array can be Divided into Pairs Divisible by K
Data Structures & Algorithms · Medium
Given an array of integers
arrand an integerk, return true if it is possible to divide the array into pairs such that the sum of each pair is divisible byk. - 03
Knight's Tour Problem
Data Structures & Algorithms · Hard
Solve the Knight's Tour problem, finding a sequence of moves for a knight on a chessboard such that it visits every square exactly once.
- 04
Find Second Largest Element in Array
Data Structures & Algorithms · Easy
Given an array of integers, find the second largest element in it.
- 05
Flatten Binary Tree to Linked List
Data Structures & Algorithms · Medium
Flatten a binary tree into a 'linked list' in-place. The 'linked list' should follow the same order as a pre-order traversal of the binary tree.
- 06
Best Time to Buy and Sell Stock
Data Structures & Algorithms · Easy
Given an array
priceswhereprices[i]is the price of a given stock on theithday, find the maximum profit you can achieve. - 07
Median in a Stream of Integers
Data Structures & Algorithms · Hard
Design a data structure that supports adding new numbers and finding the median of all numbers added so far.
- 08
Previous Permutation
Data Structures & Algorithms · Medium
Given an array of integers, find the lexicographically previous permutation of the numbers.
- 09
Lowest Common Ancestor (LCA) for N-ary Tree
Data Structures & Algorithms · Medium
Find the lowest common ancestor (LCA) of two given nodes in an N-ary tree.
- 10
Uncrossed Lines
Data Structures & Algorithms · Medium
Given two integer arrays
nums1andnums2, return the maximum number of uncrossed lines you can draw connecting elementsnums1[i]andnums2[j]such thatnums1[i] == nums2[j]and the lines do not intersect.