Amazon | Intern | Interview questions | Stipend & Other Details
- Result
- Offer
- Posted
- 10 Aug 2023
Summary
I had a 60-minute interview for an Intern position at Amazon where I was asked four LeetCode-linked questions. I provided two approaches for each problem, securing an offer for the role.
How it went
I participated in an interview for an Intern position at Amazon. The interview lasted 60 minutes. I was presented with four distinct coding problems, all of which were direct links to LeetCode problems. For each question, I was able to provide two approaches: first, an explanation of my logic, and then a more detailed explanation accompanied by code. I was told that a functional code snippet was sufficient, without needing full input/output handling. I successfully cleared the interview and received an offer.
Questions asked (4)
- 01
Linked List Cycle
Data Structures & Algorithms · Easy
Open the problemGiven the
headof a singly linked list, returntrueif there is a cycle in the linked list. Otherwise, returnfalse. There is a cycle in a linked list if some node in the list can be reached again by continuously following thenextpointers. Internally,posis used to denote the index of the node that tail'snextpointer is connected to.posis -1 if there is no cycle. Note thatposis not passed as a parameter. - 02
Linked List Cycle II
Data Structures & Algorithms · Medium
Open the problemGiven the
headof a linked list, return the node where the cycle begins. If there is no cycle, returnnull. There is a cycle in a linked list if some node in the list can be reached again by continuously following thenextpointers. Internally,posis used to denote the index of the node that tail'snextpointer is connected to.posis -1 if there is no cycle. Do not modify the linked list. - 03
Best Time to Buy and Sell Stock II
Data Structures & Algorithms · Medium
Open the problemYou are given an integer array
priceswhereprices[i]is the price of a given stock on theithday. On each day, you may decide to buy and/or sell the stock. You can only hold at most one share of the stock at any time. However, you can buy it then immediately sell it on the same day. Find the maximum profit you can achieve. - 04
Count Good Nodes in Binary Tree
Data Structures & Algorithms · Medium
Open the problemGiven a binary tree
root, a nodeXin the tree is named a 'good node' if in the path from the root toX, there are no nodes with a value greater thanX.val. Return the number of good nodes in the binary tree.