Add office photos
Employer?
Claim Account for FREE

Tower Research Capital LLC

3.6
based on 15 Reviews
Filter interviews by

Amazon Interview Questions and Answers

Updated 5 Feb 2024
Popular Designations

Q1. Best Time to Buy and Sell Stock Problem Statement

Given an array prices representing the prices of a stock where each element indicates the price at a given minute, determine the maximum profit you can achieve ...read more

Ans.

Find the maximum profit by buying and selling a stock once based on given prices.

  • Iterate through the prices array and keep track of the minimum price seen so far and the maximum profit achievable.

  • Calculate the profit by subtracting the current price from the minimum price and update the maximum profit if needed.

  • Return the maximum profit, ensuring it is not negative.

  • Example: prices = [2, 100, 150, 120], Buy at 2, sell at 150, profit = 150 - 2 = 148.

View 1 answer

Q2. Dance Team Pairing Challenge

Imagine you are helping Ninja, a dance coach, who needs to form dance pairs from the available boys and girls in a studio. Given the number of boys N, the number of girls M, and the...read more

Ans.

The challenge involves forming dance pairs from available boys and girls based on potential pairings to maximize the number of pairs.

  • Parse the input to get the number of test cases, boys, girls, and potential pairings.

  • Iterate through the potential pairings and form pairs based on the given indexes.

  • Output '1' if a set of maximum possible pairs is returned, else output '0'.

  • There can be multiple valid configurations of pairs.

  • Example: For input '2 2 2' and pairings '1 1' and '2 2...read more

Add your answer

Q3. Given k and DFS traversal string for a k-ary tree, construct the tree. The String contains P (if a parent) and L (if a leaf). E.g. - k=3, str="PPLLLLL" 2. All the strings are arranged in the following order: A,...

read more
Ans.

The question asks to construct a k-ary tree using the given k and DFS traversal string.

  • Iterate through the DFS traversal string

  • If the current character is 'P', create a parent node

  • If the current character is 'L', create a leaf node

  • Link the nodes according to the DFS traversal order

View 1 answer
Q4. Can you describe the classes and functions involved in the design of a system like Splitwise?
Ans.

Splitwise is a system for managing shared expenses among groups of people.

  • Classes: User, Expense, Group

  • Functions: addExpense(), settleUp(), calculateBalance()

Add your answer
Discover Amazon interview dos and don'ts from real experiences

Q5. "How would you tell whether a graph has a node with n degree?"

Ans.

To determine if a graph has a node with n degree, iterate through all nodes and count their edges.

  • Iterate through each node in the graph

  • Count the number of edges connected to each node

  • If any node has n edges, then the graph has a node with n degree

Add your answer
Q6. What is the difference between multiprocessing and multithreading?
Ans.

Multiprocessing involves multiple processes running concurrently, while multithreading involves multiple threads within a single process.

  • Multiprocessing utilizes multiple processes to execute tasks simultaneously.

  • Multithreading involves multiple threads within a single process sharing the same memory space.

  • Multiprocessing is typically used for CPU-bound tasks, while multithreading is more suitable for I/O-bound tasks.

  • Example: Running multiple instances of a web server on diff...read more

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Software Engineer Interview Questions from Similar Companies

3.8
 • 45 Interview Questions
3.8
 • 15 Interview Questions
4.4
 • 15 Interview Questions
4.1
 • 11 Interview Questions
3.5
 • 10 Interview Questions
View all
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
70 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter