i
Amazon
Proud winner of ABECA 2024 - AmbitionBox Employee Choice Awards
Filter interviews by
I was interviewed in Jan 2025.
ArrayList and LinkedList are both classes in Java that implement the List interface, but they have different underlying data structures.
ArrayList uses a dynamic array to store elements, providing fast random access but slower insertion and deletion.
LinkedList uses a doubly linked list to store elements, providing fast insertion and deletion but slower random access.
Choose ArrayList when you need fast random access and ...
Using Java's synchronized keyword for thread synchronization has advantages like simplicity and disadvantages like potential for deadlock. ReentrantLock offers more flexibility and control.
Advantages of synchronized keyword: simplicity, built-in support in Java
Disadvantages of synchronized keyword: potential for deadlock, lack of flexibility
ReentrantLock advantages: more flexibility, ability to try and lock with timeou...
In Java, == compares memory addresses while .equals() compares the actual values of objects.
Use == to compare primitive data types or to check if two objects reference the same memory location.
Use .equals() to compare the actual values of objects, especially for String comparisons.
Improper usage can lead to unexpected results, such as comparing objects instead of their values.
Java garbage collector manages memory by automatically deallocating memory that is no longer in use.
Java garbage collector runs in the background and identifies objects that are no longer reachable by the application.
It uses different algorithms like Mark-Sweep, Mark-Compact, and Copying to reclaim memory.
Mark-Sweep algorithm identifies and marks objects for deletion, then sweeps through and deallocates them.
Mark-Compa...
Java 8 introduced features like lambdas and Stream API which have revolutionized the way Java applications are written.
Lambdas allow for more concise and readable code by enabling functional programming style.
Stream API provides a way to process collections of objects in a functional way, allowing for easier parallel processing and improved performance.
Java 8 also introduced default methods in interfaces, allowing for ...
Checked exceptions must be handled at compile time, while unchecked exceptions do not need to be caught or declared.
Checked exceptions are subclasses of Exception class, while unchecked exceptions are subclasses of RuntimeException class.
Checked exceptions must be caught or declared in the method signature using 'throws', while unchecked exceptions do not have this requirement.
Examples of checked exceptions include IOE...
The Java Memory Model defines how threads interact through memory and how synchronization ensures visibility and consistency.
Java Memory Model specifies how threads interact with memory
Synchronization ensures visibility and consistency of shared data among threads
Volatile keyword ensures changes made by one thread are immediately visible to other threads
Example: Using volatile keyword to share a boolean flag among mult
Method overloading is when multiple methods have the same name but different parameters, while method overriding is when a subclass provides a specific implementation of a method in its superclass.
Method overloading is achieved within the same class by having multiple methods with the same name but different parameters.
Method overriding occurs in a subclass that provides a specific implementation of a method that is al...
Functional interfaces in Java are interfaces with a single abstract method. They can be used with lambda expressions for functional programming.
Functional interfaces have only one abstract method, but can have multiple default or static methods.
Lambda expressions can be used to implement the abstract method of a functional interface concisely.
An example of a custom functional interface is 'Calculator' with a single abs
Java Stream is a sequence of elements that supports functional-style operations. It differs from Iterator by being more declarative and allowing for parallel processing.
Java Stream is a high-level abstraction over collections that allows for functional-style operations like map, filter, reduce, etc.
Streams are more declarative compared to Iterators, which are imperative. This means that with Streams, you specify what y...
Immutability in Java means objects cannot be modified after creation. String class achieves immutability by not allowing changes to its value.
Immutability means once an object is created, its state cannot be changed.
String class in Java is immutable because its value cannot be modified once it is assigned.
Advantages of immutable objects include thread safety, security, and ease of caching.
final, finally, and finalize have different meanings in Java.
final is a keyword used to restrict the user from changing the value of a variable, making it a constant.
finally is a block of code that is always executed, whether an exception is thrown or not.
finalize is a method used for cleanup operations before an object is garbage collected.
Singleton design pattern ensures a class has only one instance and provides a global point of access to it.
Create a private static instance of the class within the class itself.
Provide a public static method to access the instance, creating it if necessary.
Make the constructor private to prevent instantiation from outside the class.
Use synchronized keyword or double-checked locking to ensure thread safety.
Java annotations are metadata that provide data about a program but do not affect the program itself. They are used in frameworks like Spring to configure and customize behavior.
Java annotations are used to provide metadata about classes, methods, fields, etc. in a program.
In frameworks like Spring, annotations are used to configure various aspects of the application, such as dependency injection, transaction managemen...
Java Streams can handle parallel processing using parallel streams. Pitfalls include increased complexity and potential for race conditions.
Java Streams can be processed in parallel by calling the parallel() method on a stream.
Potential pitfalls of using parallel streams include increased complexity, potential for race conditions, and performance overhead due to thread management.
To mitigate these pitfalls, ensure that...
ArrayList is preferred for frequent retrieval operations due to fast random access, while LinkedList is suitable for frequent insertions/deletions with fast O(1) complexity.
Use ArrayList for scenarios where frequent retrieval operations are needed, such as searching for elements in a large collection.
Choose LinkedList when frequent insertions/deletions are required, like maintaining a queue or stack with dynamic size.
C...
ReentrantLock should be used instead of synchronized when more flexibility and control over locking mechanisms is required.
Use ReentrantLock when you need to implement advanced locking mechanisms like tryLock() or lockInterruptibly()
ReentrantLock supports fair locking, ensuring that threads acquire the lock in the order they requested it
Explicit unlocking in ReentrantLock can help prevent deadlocks and improve performa
In Java, == checks for reference equality while equals() checks for value equality. Misuse of == can lead to logical errors.
Override equals() when you want to compare the actual content of objects in user-defined classes.
Override hashCode() method alongside equals() to ensure consistent behavior in collections like HashMap.
Implement Comparable interface and override compareTo() method for natural ordering of objects.
Garbage collection in Java automatically reclaims memory occupied by unused objects using different GC algorithms and memory regions.
Force garbage collection in Java can be done using System.gc() or Runtime.gc() methods.
It is generally not recommended to force garbage collection as it can disrupt the JVM's natural memory management process and cause performance issues.
Forcing garbage collection may not guarantee immedi...
Lambda expressions in Java 8 improve readability and maintainability by enabling concise and functional-style programming.
Lambda expressions allow writing more compact code by reducing boilerplate code.
They enable passing behavior as arguments to methods, making code more modular and flexible.
Example: (a, b) -> a + b is a lambda expression that adds two numbers.
Find the element that is repeated once in an array where all elements are repeated twice
Iterate through the array and use a hashmap to keep track of the count of each element
Once the iteration is complete, check the hashmap for the element with a count of 1
Find the maximum diagonal sum of a binary tree
Traverse the tree diagonally and keep track of the sum at each diagonal level
Use a hashmap to store the sum at each diagonal level
Return the maximum sum from the hashmap
I applied via Approached by Company and was interviewed before Feb 2023. There were 3 interview rounds.
Detect if a binary tree is symmetric.
Check if the left and right subtrees are mirror images of each other.
Use a recursive approach to compare corresponding nodes.
Base case: if both nodes are null, return true.
If one node is null and the other is not, return false.
If the values of the nodes are not equal, return false.
Recursively check if the left subtree of the left node is symmetric to the right subtree of the right n...
Finding the merge point of two linked lists.
Traverse both linked lists to find their lengths.
Move the pointer of the longer list ahead by the difference in lengths.
Iterate both lists simultaneously until the merge point is found.
The question is about advanced data structures and algorithms for a senior software engineer role.
Focus on advanced data structures like AVL trees, B-trees, and tries
Discuss complex algorithms like Dijkstra's algorithm, A* search algorithm, and dynamic programming
Highlight experience with optimizing time and space complexity
Provide examples of solving challenging coding problems or implementing complex algorithms
What people are saying about Amazon
Basic data structure and algorithm problem
Amazon interview questions for designations
I applied via Company Website and was interviewed in Mar 2023. There were 2 interview rounds.
Computer information , and software
Algorithm, software information, words,
Get interview-ready with Top Amazon Interview Questions
I applied via Company Website and was interviewed before Jun 2023. There were 2 interview rounds.
Online coding test with 2 questions
Count the number of islands in a 2D grid where '1' represents land and '0' represents water.
Iterate through the grid and for each '1' encountered, perform a depth-first search to mark all adjacent '1's as visited.
Increment the island count for each new island found.
Ensure to handle boundary conditions and visited cells properly to avoid infinite loops.
I applied via Indeed and was interviewed in Nov 2022. There were 3 interview rounds.
Implementing Hashed Map
Online test about working.
I applied via Newspaper Ad
General question of aptitude we're asked about background
Leetcode medium questions were asked by them
I applied via Company Website and was interviewed in Jul 2022. There were 2 interview rounds.
Some of the top questions asked at the Amazon Software Engineer interview for freshers -
The duration of Amazon Software Engineer interview process can vary, but typically it takes about less than 2 weeks to complete.
based on 9 interviews
3 Interview rounds
based on 150 reviews
Rating in categories
Customer Service Associate
4.2k
salaries
| ₹0 L/yr - ₹0 L/yr |
Transaction Risk Investigator
3.1k
salaries
| ₹0 L/yr - ₹0 L/yr |
Associate
2.8k
salaries
| ₹0 L/yr - ₹0 L/yr |
Senior Associate
2.5k
salaries
| ₹0 L/yr - ₹0 L/yr |
Program Manager
2.1k
salaries
| ₹0 L/yr - ₹0 L/yr |
Flipkart
TCS
Netflix