Full Stack Developer

1000+ Full Stack Developer Interview Questions and Answers

Updated 12 Jul 2025
search-icon

Asked in Amazon

1w ago

Q. LRU Cache Design Question

Design a data structure for a Least Recently Used (LRU) cache that supports the following operations:

1. get(key) - Return the value of the key if it exists in the cache; otherwise, re...read more

Ans.

Design a Least Recently Used (LRU) cache data structure that supports get and put operations with a given capacity.

  • Implement a doubly linked list to keep track of the order of keys based on their recent usage.

  • Use a hashmap to store key-value pairs for quick access and updates.

  • When capacity is reached, evict the least recently used item before inserting a new item.

  • Update the position of a key in the linked list whenever it is accessed or updated.

Asked in MAQ Software

6d ago

Q. Sort 0 1 2 Problem Statement

Given an integer array arr of size 'N' containing only 0s, 1s, and 2s, write an algorithm to sort the array.

Input:

The first line contains an integer 'T' representing the number of...read more
Ans.

Sort an integer array containing only 0s, 1s, and 2s in linear time complexity.

  • Use three pointers to keep track of 0s, 1s, and 2s while traversing the array.

  • Swap elements based on the values encountered to sort the array in-place.

  • Time complexity should be O(N) to solve the problem efficiently.

4d ago

Q. Ways To Make Coin Change

Given an infinite supply of coins of varying denominations, determine the total number of ways to make change for a specified value using these coins. If it's not possible to make the c...read more

Ans.

The task is to find the total number of ways to make change for a specified value using given denominations.

  • Use dynamic programming to solve this problem efficiently.

  • Create a 2D array to store the number of ways to make change for each value up to the specified value.

  • Iterate through the denominations and update the array based on the current denomination.

  • Return the value at the last cell of the array as the final result.

Asked in Amazon

5d ago

Q. Maximum Consecutive Ones Problem Statement

Given a binary array 'ARR' of size 'N', your task is to determine the maximum length of a sequence consisting solely of 1’s that can be obtained by converting at most ...read more

Ans.

Find the maximum length of a sequence of 1's by converting at most K zeroes into ones in a binary array.

  • Iterate through the array and keep track of the current window of 1's and zeroes.

  • Use a sliding window approach to find the maximum length of the sequence.

  • Update the window by flipping zeroes to ones within the limit of K flips.

  • Return the maximum length of the sequence obtained.

Are these interview questions helpful?
1w ago

Q. N Queens Problem

Given an integer N, find all possible placements of N queens on an N x N chessboard such that no two queens threaten each other.

Explanation:

A queen can attack another queen if they are in the...read more

Ans.

The N Queens Problem involves finding all possible placements of N queens on an N x N chessboard where no two queens threaten each other.

  • Use backtracking algorithm to explore all possible configurations.

  • Keep track of rows, columns, and diagonals to ensure queens do not threaten each other.

  • Generate valid configurations recursively and backtrack when a solution is not possible.

2w ago

Q. Topological Sort Problem Statement

Given a Directed Acyclic Graph (DAG) consisting of V vertices and E edges, your task is to find any topological sorting of this DAG. You need to return an array of size V repr...read more

Ans.

Topological sort of a Directed Acyclic Graph (DAG) is finding an ordering of vertices where for every directed edge u -> v, u comes before v.

  • Use Depth First Search (DFS) to find the topological ordering of vertices in a DAG.

  • Start by visiting a vertex and recursively visit its neighbors, adding the vertex to the result after visiting all neighbors.

  • Maintain a visited array to keep track of visited vertices and a stack to store the topological ordering.

  • Once all vertices are visi...read more

Full Stack Developer Jobs

SAP India Pvt.Ltd logo
Senior Full-Stack Developer 5-8 years
SAP India Pvt.Ltd
4.2
₹ 8 L/yr - ₹ 30 L/yr
(AmbitionBox estimate)
Bangalore / Bengaluru
Schneider Electric India  Pvt. Ltd. logo
Full Stack Developer-Architect 4-12 years
Schneider Electric India Pvt. Ltd.
4.1
Bangalore / Bengaluru
Schneider Electric India  Pvt. Ltd. logo
Full Stack Developer: Node.JS 3-6 years
Schneider Electric India Pvt. Ltd.
4.1
Bangalore / Bengaluru

Asked in MakeMyTrip

2w ago

Q. Number of Islands II Problem Statement

You have a 2D grid of dimensions 'N' rows by 'M' columns, initially filled with water. You are given 'Q' queries, where each query contains two integers 'X' and 'Y'. Durin...read more

Ans.

The task is to determine the number of islands present on a 2D grid after each query of converting water to land.

  • Create a function that takes the grid dimensions, number of queries, and query coordinates as input.

  • For each query, convert the water at the given coordinates to land and then count the number of islands on the grid.

  • Use depth-first search (DFS) or breadth-first search (BFS) to identify connected land cells forming islands.

  • Return the number of islands after each que...read more

Asked in Tata 1mg

2w ago

Q. Rotational Equivalence of Strings Problem Statement

Given two strings 'P' and 'Q' of equal length, determine if string 'P' can be transformed into string 'Q' by cyclically rotating it to the right any number of...read more

Ans.

The task is to check if one string can be converted into another string by cyclically rotating it to the right any number of times.

  • Check if the lengths of the two strings are equal. If not, return 0.

  • Concatenate the first string with itself and check if the second string is a substring of the concatenated string.

  • If the second string is a substring, return 1. Otherwise, return 0.

Share interview questions and help millions of jobseekers 🌟

man-with-laptop
2w ago

Q. Cousin Nodes in a Binary Tree

Determine if two nodes in a binary tree are cousins. Nodes are considered cousins if they are at the same level and have different parents.

Explanation:

In a binary tree, each node...read more

Ans.

Determine if two nodes in a binary tree are cousins based on level and parent nodes.

  • Traverse the binary tree to find the levels and parents of the given nodes.

  • Check if the nodes are at the same level and have different parents to determine if they are cousins.

  • Return 'YES' if the nodes are cousins, 'NO' otherwise.

  • Example: For input '1 2 3 4 -1 5 6 -1 7 -1 -1 -1 -1 -1 -1' and nodes 4 7, output is 'YES'.

Asked in PayPal

2d ago

Q. Friends Pairing Problem

The task is to determine the total number of ways to pair up 'N' friends or leave some of them single, following these rules:

  1. Each friend can either pair with one other friend or stay s...read more
Ans.

The task is to determine the total number of ways to pair up 'N' friends or leave some of them single.

  • Use dynamic programming to solve the problem efficiently.

  • Consider the base cases when N is 1, 2, and 3 to derive the general formula.

  • The result should be computed modulo 10^9 + 7 to handle large outputs.

Asked in Amazon

1w ago

Q. Next Greater Element Problem Statement

Given a list of integers of size N, your task is to determine the Next Greater Element (NGE) for every element. The Next Greater Element for an element X is the first elem...read more

Ans.

The task is to find the Next Greater Element for each element in a list of integers.

  • Iterate through the list of integers from right to left

  • Use a stack to keep track of elements whose NGE is yet to be found

  • Pop elements from the stack until a greater element is found or the stack is empty

  • Assign the NGE as the top element of the stack or -1 if the stack is empty

Asked in Amazon

2w ago

Q. Anagram Pairs Verification Problem

Your task is to determine if two given strings are anagrams of each other. Two strings are considered anagrams if you can rearrange the letters of one string to form the other...read more

Ans.

Determine if two strings are anagrams of each other by checking if they contain the same characters.

  • Create character frequency maps for both strings

  • Compare the frequency of characters in both maps to check if they are anagrams

  • Return True if the strings are anagrams, False otherwise

1w ago

Q. Find the Third Greatest Element

Given an array 'ARR' of 'N' distinct integers, determine the third largest element in the array.

Input:

The first line contains a single integer 'T' representing the number of te...read more
Ans.

Find the third largest element in an array of distinct integers.

  • Sort the array in descending order and return the element at index 2.

  • Handle cases where the array has less than 3 elements separately.

  • Consider edge cases like negative numbers and duplicates.

Asked in Paytm

6d ago

Q. Minimum Characters to Make a String Palindrome

Given a string STR of length N, determine the minimum number of characters to be added to the front of the string to make it a palindrome.

Input:

The first line co...read more
Ans.

The task is to find the minimum number of characters needed to be added to the front of a string to make it a palindrome.

  • Iterate through the string from both ends and count the number of characters that need to be added to make it a palindrome.

  • Use two pointers approach to compare characters from start and end of the string.

  • Keep track of the count of characters needed to be added to form a palindrome.

Asked in Paytm

2w ago

Q. Odd Even Levels in Binary Tree

Given a binary tree, the task is to compute the modulus of the difference between the sum of nodes at odd levels and the sum of nodes at even levels.

Input:

The first line contain...read more
Ans.

The task is to compute the modulus of the difference between the sum of nodes at odd levels and the sum of nodes at even levels in a binary tree.

  • Traverse the binary tree level by level and calculate the sum of nodes at odd and even levels separately.

  • Find the absolute difference between the sums and return the modulus of this difference.

  • Handle null nodes by skipping them during the sum calculation.

Asked in Amazon

5d ago

Q. Optimize Memory Usage Problem Statement

Alex wants to maximize the use of 'K' memory spaces on his computer. He has 'N' different document downloads, each with unique memory usage, and 'M' computer games, each ...read more

Ans.

Maximize memory usage by pairing downloads and games within memory limit 'K'.

  • Sort the downloads and games in descending order.

  • Iterate through the downloads and games to find the pairs within memory limit 'K'.

  • Return the pairs that maximize memory usage.

Asked in Amadeus

1w ago

Q. Sort Array of Strings Problem Statement

Given an array of strings ARRSTR[] of size N, and a character C, your task is to sort the ARRSTR[] array according to a new alphabetical order that starts with the given ...read more

Ans.

Sort an array of strings based on a new alphabetical order starting with a given character.

  • Iterate through the array of strings and compare each string based on the new alphabetical order starting with the given character.

  • Implement a custom sorting function that considers the new alphabetical order.

  • Return the sorted array of strings.

Q. Merge Sort Problem Statement

You are given a sequence of numbers, ARR. Your task is to return a sorted sequence of ARR in non-descending order using the Merge Sort algorithm.

Explanation:

The Merge Sort algorit...read more

Ans.

Implement Merge Sort algorithm to sort a sequence of numbers in non-descending order.

  • Understand the Merge Sort algorithm which involves dividing the array into two halves, sorting each half, and then merging them back together.

  • Recursively apply the Merge Sort algorithm until the size of each array is 1.

  • Merge the sorted halves to produce the final sorted array.

  • Ensure to handle the input constraints such as the number of test cases, elements in the array, and the range of eleme...read more

1w ago

Q. Check Permutation Problem Statement

Determine if two given strings, 'str1' and 'str2', are permutations of each other.

Explanation:

Two strings are permutations of each other if one string's characters can be r...read more

Ans.

Check if two strings are permutations of each other.

  • Create a character frequency map for both strings and compare them.

  • If the frequency of characters in both maps is the same, return true.

  • Handle edge cases like empty strings or strings of different lengths.

1w ago

Q. Cycle Detection in Undirected Graph Problem Statement

You are provided with an undirected graph containing 'N' vertices and 'M' edges. The vertices are numbered from 1 to 'N'. Your objective is to determine whe...read more

Ans.

Detect if an undirected graph contains a cycle by exploring all possible paths.

  • Use Depth First Search (DFS) to traverse the graph and detect cycles.

  • Maintain a visited set to keep track of visited vertices and a parent pointer to avoid revisiting the same vertex.

  • If a visited vertex is encountered that is not the parent of the current vertex, a cycle is present.

  • Check for cycles in each connected component of the graph.

  • Example: For input N=3, Edges=[[1, 2], [2, 3], [1, 3]], the ...read more

Asked in Amazon

1w ago

Q. Longest Common Prefix Problem Statement

You are given an array ‘ARR’ consisting of ‘N’ strings. Your task is to find the longest common prefix among all these strings. If there is no common prefix, you have to ...read more

Ans.

Find the longest common prefix among an array of strings.

  • Iterate through the strings character by character to find the longest common prefix

  • Use a loop to compare characters of all strings at the same index

  • Return the prefix once a character mismatch is found

Asked in MTX Group

2w ago
Q. ...read more

AVL Tree Insertion Problem

Given an AVL tree, your task is to insert an element into the AVL Tree ensuring it remains balanced.

An AVL tree is a self-balancing binary search tree with the following properties:

Ans.

Insert an element into an AVL tree while maintaining balance.

  • Ensure the AVL tree remains balanced after insertion by performing rotations if necessary.

  • Update the height of each node after insertion to maintain the AVL property.

  • Perform single or double rotations based on the balance factor of the nodes.

  • Example: Inserting 7 into the AVL tree shown in the image would require a double rotation to balance the tree.

Asked in Deloitte

1w ago

Q. Bursting Balloons Problem

Given an array ARR of size N, where each element represents the height of a balloon. The task is to destroy all balloons by shooting arrows from left to right. When an arrow hits a bal...read more

Ans.

Find the minimum number of arrows needed to burst all balloons by shooting arrows from left to right.

  • Sort the array in ascending order to make it easier to determine the minimum number of arrows needed.

  • Iterate through the sorted array and count the number of times the height decreases.

  • The count of height decreases plus 1 gives the minimum number of arrows needed to burst all balloons.

Asked in Amazon

1d ago

Q. Number of Islands Problem Statement

Given a non-empty grid of 0s and 1s, determine the number of distinct islands. An island is a collection of '1's (land) connected horizontally, vertically, or diagonally. It ...read more

Ans.

The task is to determine the number of distinct islands in a grid of 0s and 1s connected horizontally, vertically, or diagonally.

  • Iterate through the grid and perform depth-first search (DFS) to find connected '1's forming islands.

  • Use a set to keep track of visited cells to avoid counting the same island multiple times.

  • Increment the island count each time a new island is encountered.

  • Consider edge cases such as grid boundaries and handling '0's as water.

  • Implement a recursive DF...read more

Asked in Paytm

1w ago

Q. Print Nodes at Distance K from a Given Node

Given an arbitrary binary tree, a node of the tree, and an integer 'K', find all nodes that are at a distance K from the specified node, and return a list of these no...read more

Ans.

Given a binary tree, a target node, and an integer K, find all nodes at distance K from the target node.

  • Traverse the binary tree to find the target node.

  • Use BFS to traverse the tree and find nodes at distance K from the target node.

  • Keep track of the distance of each node from the target node while traversing.

  • Return the values of nodes at distance K in any order.

1w ago

Q. Queue Using Stacks Implementation

Design a queue data structure following the FIFO (First In First Out) principle using only stack instances.

Explanation:

Your task is to complete predefined functions to suppor...read more

Ans.

Implement a queue using stacks following FIFO principle.

  • Use two stacks to simulate a queue - one for enqueue and one for dequeue operations.

  • For enQueue operation, push elements onto the enqueue stack.

  • For deQueue operation, if the dequeue stack is empty, pop all elements from enqueue stack to dequeue stack.

  • For peek operation, return the top element of the dequeue stack.

  • For isEmpty operation, check if both stacks are empty.

  • Example: enQueue(5), enQueue(10), peek() -> 5, deQueue(...read more

Asked in Samsung

2d ago

Q. Rotate Matrix by 90 Degrees Problem Statement

Given a square matrix 'MATRIX' of non-negative integers, rotate the matrix by 90 degrees in an anti-clockwise direction using only constant extra space.

Input:

The ...read more
Ans.

Rotate a square matrix by 90 degrees in an anti-clockwise direction using constant extra space.

  • Iterate through each layer of the matrix from outer to inner layers

  • Swap elements in groups of 4 to rotate the matrix

  • Handle odd-sized matrices by adjusting the center element if needed

Asked in Amazon

1w ago

Q. Shortest Path in a Binary Matrix Problem Statement

Given a binary matrix of size N * M where each element is either 0 or 1, find the shortest path from a source cell to a destination cell, consisting only of 1s...read more

Ans.

Find the shortest path in a binary matrix from a source cell to a destination cell consisting only of 1s.

  • Use Breadth First Search (BFS) algorithm to find the shortest path.

  • Keep track of visited cells to avoid revisiting them.

  • Calculate the path length by counting the number of 1s in the path.

  • Handle edge cases such as invalid inputs and unreachable destination.

Asked in Amazon

2w ago

Q. Square Root with Decimal Precision Problem Statement

You are provided with two integers, 'N' and 'D'. Your objective is to determine the square root of the number 'N' with a precision up to 'D' decimal places. ...read more

Ans.

Implement a function to find the square root of a number with a given precision.

  • Create a function that takes 'N' and 'D' as input parameters

  • Use a mathematical algorithm like Newton's method to approximate the square root

  • Iterate until the precision condition is met

  • Return the square root with the required precision

Asked in SAP

2w ago

Q. Factorial of a Number Problem Statement

You are provided with an integer 'N'. Your task is to calculate and print the factorial of 'N'. The factorial of a number 'N', denoted as N!, is the product of all positi...read more

Ans.

Calculate and print the factorial of a given integer 'N'.

  • Iterate from 1 to N and multiply each number to calculate factorial

  • Handle edge cases like N=0 or N=1 separately

  • Use recursion to calculate factorial efficiently

Previous
1
2
3
4
5
6
7
Next

Interview Experiences of Popular Companies

TCS Logo
3.6
 • 11.1k Interviews
Accenture Logo
3.7
 • 8.7k Interviews
Wipro Logo
3.7
 • 6.1k Interviews
Cognizant Logo
3.7
 • 5.9k Interviews
Capgemini Logo
3.7
 • 5.1k Interviews
View all
interview tips and stories logo
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories
Full Stack Developer Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

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

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits