Amazon | Intern | Interview questions | Stipend & Other Details

amazon logo
amazon
InternOffer
August 10, 20230 reads

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.

Full Experience

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.

Interview Questions (4)

Q1
Linked List Cycle
Data Structures & AlgorithmsEasy

Given the head of a singly linked list, return true if there is a cycle in the linked list. Otherwise, return false. There is a cycle in a linked list if some node in the list can be reached again by continuously following the next pointers. Internally, pos is used to denote the index of the node that tail's next pointer is connected to. pos is -1 if there is no cycle. Note that pos is not passed as a parameter.

Q2
Linked List Cycle II
Data Structures & AlgorithmsMedium

Given the head of a linked list, return the node where the cycle begins. If there is no cycle, return null. There is a cycle in a linked list if some node in the list can be reached again by continuously following the next pointers. Internally, pos is used to denote the index of the node that tail's next pointer is connected to. pos is -1 if there is no cycle. Do not modify the linked list.

Q3
Best Time to Buy and Sell Stock II
Data Structures & AlgorithmsMedium

You are given an integer array prices where prices[i] is the price of a given stock on the ith day. 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.

Q4
Count Good Nodes in Binary Tree
Data Structures & AlgorithmsMedium

Given a binary tree root, a node X in the tree is named a 'good node' if in the path from the root to X, there are no nodes with a value greater than X.val. Return the number of good nodes in the binary tree.

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!