Full Stack Developer

1000+ Full Stack Developer Interview Questions and Answers

Updated 7 Jul 2025
search-icon

Asked in Amazon

1w ago

Q. Find Duplicate in Array Problem Statement

You are provided with an array of integers 'ARR' consisting of 'N' elements. Each integer is within the range [1, N-1], and the array contains exactly one duplicated el...read more

Ans.

Find the duplicate element in an array of integers.

  • Iterate through the array and keep track of the frequency of each element using a hashmap.

  • Return the element with a frequency greater than 1 as the duplicate.

  • Time complexity should be O(n) and space complexity should be O(n).

Asked in Adobe

4d ago

Q. LCA in a Binary Search Tree

You are given a binary search tree (BST) containing N nodes. Additionally, you have references to two nodes, P and Q, within this BST.

Your task is to determine the Lowest Common Anc...read more

Ans.

Find the Lowest Common Ancestor (LCA) of two nodes in a Binary Search Tree (BST).

  • Traverse the BST from the root node to find the LCA of the given nodes.

  • Compare the values of the nodes with the values of P and Q to determine the LCA.

  • If the values of P and Q are on opposite sides of the current node, then the current node is the LCA.

Asked in MakeMyTrip

2w ago

Q. Maximum Sum of Products for Array Rotations

You are given an array ARR consisting of N elements. Your task is to determine the maximum value of the summation of i * ARR[i] among all possible rotations of ARR. R...read more

Ans.

Find the maximum sum of products for array rotations.

  • Iterate through all possible rotations of the array and calculate the sum of products for each rotation.

  • Keep track of the maximum sum of products found so far.

  • Return the maximum sum of products obtained.

Asked in Flipkart

2w ago

Q. Validate BST Problem Statement

Given a binary tree with N nodes, determine whether the tree is a Binary Search Tree (BST). If it is a BST, return true; otherwise, return false.

A binary search tree (BST) is a b...read more

Ans.

Validate if a binary tree is a Binary Search Tree (BST) based on given properties.

  • Check if the left subtree of a node contains only nodes with data less than the node's data.

  • Verify if the right subtree of a node contains only nodes with data greater than the node's data.

  • Ensure that both the left and right subtrees are also binary search trees.

  • Iterate through the tree in level order form to validate the BST properties.

Are these interview questions helpful?

Asked in Walmart

1w ago

Q. House Robber Problem Statement

Mr. X is a professional robber with a plan to rob houses arranged in a circular street. Each house has a certain amount of money hidden, separated by a security system that alerts...read more

Ans.

The task is to find the maximum amount of money Mr. X can rob from houses arranged in a circle without alerting the police.

  • The problem can be solved using dynamic programming.

  • Create two arrays to store the maximum amount of money robbed when considering the first house and when not considering the first house.

  • Iterate through the array and update the maximum amount of money robbed at each house.

  • The final answer will be the maximum of the last element in both arrays.

Asked in Amazon

1w ago

Q. Relative Sorting Problem Statement

You are given two arrays, 'ARR' of size 'N' and 'BRR' of size 'M'. Your task is to sort the elements of 'ARR' such that their relative order matches that in 'BRR'. Any element...read more

Ans.

Sort elements of ARR to match relative order in BRR, append missing elements at the end in sorted order.

  • Create a hashmap to store the index of elements in BRR for quick lookup.

  • Sort elements in ARR based on their index in BRR, append missing elements at the end.

  • Handle edge cases like empty arrays or duplicate elements in ARR and BRR.

Full Stack Developer Jobs

Siemens Healthcare logo
Full Stack Developer 2-5 years
Siemens Healthcare
4.1
Bangalore / Bengaluru
IBM India Pvt. Limited logo
Full Stack Developer 4-9 years
IBM India Pvt. Limited
4.0
Bangalore / Bengaluru
SAP India Pvt.Ltd logo
Senior Full stack Developer 10-15 years
SAP India Pvt.Ltd
4.2
Bangalore / Bengaluru

Asked in Housing.com

2w ago

Q. Word Ladder Problem Statement

Given two strings, BEGIN and END, along with an array of strings DICT, determine the length of the shortest transformation sequence from BEGIN to END. Each transformation involves ...read more

Ans.

The Word Ladder problem involves finding the shortest transformation sequence from one word to another by changing one letter at a time.

  • Use breadth-first search to find the shortest transformation sequence.

  • Create a graph where each word is a node and words that can be transformed into each other are connected.

  • Keep track of visited words to avoid cycles and optimize the search process.

  • Return -1 if no transformation sequence is possible.

  • Example: For input 'hit', 'cog', and dict...read more

Asked in SAP

1w ago

Q. Build Max Heap Problem Statement

Given an integer array with N elements, the task is to transform this array into a max binary heap structure.

Explanation:

A max-heap is a complete binary tree where each intern...read more

Ans.

The task is to transform an integer array into a max binary heap structure.

  • Create a max heap from the given array by rearranging elements

  • Ensure each internal node has a value greater than or equal to its children

  • Check if the transformed array represents a max-heap and output 1 if true, 0 if false

Share interview questions and help millions of jobseekers 🌟

man-with-laptop

Asked in TO THE NEW

4d ago

Q. Character Counting Challenge

Create a program that counts and prints the total number of specific character types from user input. Specifically, you need to count lowercase English alphabets, numeric digits (0-...read more

Ans.

Create a program that counts lowercase alphabets, digits, and white spaces from user input until '$' is encountered.

  • Read characters from input stream until '$' is encountered

  • Count lowercase alphabets, digits, and white spaces separately

  • Print the counts of each character type as three integers separated by spaces

Asked in PayPal

4d ago

Q. Divide Two Integers Problem Statement

You are given two integers dividend and divisor. Your task is to divide the integers without using multiplication, division, and modular operators. Return the quotient afte...read more

Ans.

Divide two integers without using multiplication, division, and modular operators, returning the floored value of the quotient.

  • Implement division using bit manipulation and subtraction

  • Handle edge cases like negative numbers and overflow

  • Return the floored value of the quotient

Asked in Amazon

6d ago

Q. Group Anagrams Together

Given an array/list of strings STR_LIST, group the anagrams together and return each group as a list of strings. Each group must contain strings that are anagrams of each other.

Example:...read more

Ans.

Group anagrams in a list of strings together and return each group as a list of strings.

  • Iterate through the list of strings and sort each string alphabetically to create a key for grouping.

  • Use a hashmap to store the sorted string as key and the original string as value.

  • Return the values of the hashmap as the grouped anagrams.

Asked in Amazon

3d ago

Q. Maximum Subarray Sum Problem Statement

Given an array ARR consisting of N integers, your goal is to determine the maximum possible sum of a non-empty contiguous subarray within this array.

Example of Subarrays:...read more

Ans.

Find the maximum sum of a contiguous subarray within an array of integers.

  • Iterate through the array and keep track of the maximum sum of subarrays seen so far.

  • Use Kadane's algorithm to efficiently find the maximum subarray sum.

  • Consider edge cases like all negative numbers in the array.

  • Example: For input [-2, 1, -3, 4, -1], the maximum subarray sum is 4.

Q. Middle of a Linked List

You are given the head node of a singly linked list. Your task is to return a pointer pointing to the middle of the linked list.

If there is an odd number of elements, return the middle ...read more

Ans.

Return the middle element of a singly linked list, or the one farther from the head if there are even elements.

  • Traverse the linked list with two pointers, one moving twice as fast as the other

  • When the fast pointer reaches the end, the slow pointer will be at the middle

  • If there are even elements, return the one pointed by the slow pointer

Asked in Hike

1w ago

Q. Minimum Number of Swaps to Sort an Array

Find the minimum number of swaps required to sort a given array of distinct elements in ascending order.

Input:

T (number of test cases)
For each test case:
N (size of the...read more
Ans.

The minimum number of swaps required to sort a given array of distinct elements in ascending order.

  • Use a hashmap to store the original indices of the elements in the array.

  • Iterate through the array and swap elements to their correct positions.

  • Count the number of swaps needed to sort the array.

Asked in PayPal

2w ago

Q. Rearrange String Problem Statement

Given a string ‘S’, your task is to rearrange its characters so that no two adjacent characters are the same. If it's possible, return any such arrangement, otherwise return “...read more

Ans.

Given a string, rearrange its characters so that no two adjacent characters are the same. Return 'Yes' if possible, 'No' otherwise.

  • Iterate through the string and count the frequency of each character

  • Use a priority queue to rearrange characters based on frequency

  • Check if the rearranged string has no two adjacent characters the same

  • Return 'Yes' if possible, 'No' otherwise

Asked in DE Shaw

1w ago

Q. Buy and Sell Stock Problem Statement

Imagine you are Harshad Mehta's friend, and you have been given the stock prices of a particular company for the next 'N' days. You can perform up to two buy-and-sell transa...read more

Ans.

The task is to determine the maximum profit that can be achieved by performing up to two buy-and-sell transactions on a given set of stock prices.

  • Iterate through the array of stock prices to find the maximum profit that can be achieved by buying and selling stocks at different points.

  • Keep track of the maximum profit that can be achieved by considering all possible combinations of buy and sell transactions.

  • Ensure that you sell the stock before buying again to adhere to the con...read more

Asked in Oracle

1w ago

Q. Construct Tree from Preorder Traversal

Given a list of integers pre[] of size n, representing the preorder traversal of a special binary tree where each node has 0 or 2 children, and a boolean array isLeaf[] in...read more

Ans.

Construct a binary tree from preorder traversal and leaf node information.

  • Create a binary tree using preorder traversal and leaf node information

  • Use recursion to build the tree

  • Handle both leaf and non-leaf nodes appropriately

Asked in Amazon

2w ago

Q. Container with Most Water Problem Statement

Given a sequence of 'N' space-separated non-negative integers A[1], A[2], ..., A[i], ..., A[n], where each number in the sequence represents the height of a line draw...read more

Ans.

Find the maximum area of water that can be contained between any two lines on a plane.

  • Iterate through the array of heights using two pointers approach to find the maximum area.

  • Calculate the area using the formula: area = (min(height[left], height[right]) * (right - left)).

  • Move the pointer pointing to the smaller height towards the center to potentially find a larger area.

Asked in Intuit

2w ago

Q. Count Pairs with Given Sum

Given an integer array/list arr and an integer 'Sum', determine the total number of unique pairs in the array whose elements sum up to the given 'Sum'.

Input:

The first line contains ...read more
Ans.

Count the total number of unique pairs in an array whose elements sum up to a given value.

  • Use a hashmap to store the frequency of each element in the array.

  • Iterate through the array and for each element, check if (Sum - current element) exists in the hashmap.

  • Increment the count of pairs if the complement exists in the hashmap.

  • Divide the count by 2 to avoid counting duplicates like (arr[i], arr[j]) and (arr[j], arr[i]) separately.

2w ago

Q. Find the Longest Palindromic Substring

Given a string ‘S’ composed of lowercase English letters, your task is to identify the longest palindromic substring within ‘S’.

If there are multiple longest palindromic ...read more

Ans.

Find the longest palindromic substring in a given string, returning the rightmost one if multiple exist.

  • Iterate through each character in the string and expand around it to find palindromes

  • Keep track of the longest palindrome found and its starting index

  • Return the substring starting from the index of the longest palindrome found

Asked in Amazon

1w ago

Q. Find the Row with the Maximum Number of 1's

You are given a non-empty grid MAT with 'N' rows and 'M' columns, where each element is either 0 or 1. All rows are sorted in ascending order.

Your task is to determi...read more

Ans.

Find the row with the maximum number of 1's in a grid of 0's and 1's, returning the index of the row with the most 1's.

  • Iterate through each row of the grid and count the number of 1's in each row

  • Keep track of the row index with the maximum number of 1's seen so far

  • Return the index of the row with the maximum number of 1's

Asked in Amazon

5d ago

Q. Kth Smallest and Largest Element Problem Statement

You are provided with an array 'Arr' containing 'N' distinct integers and a positive integer 'K'. Your task is to find the Kth smallest and Kth largest element...read more

Ans.

Find the Kth smallest and largest elements in an array.

  • Sort the array to easily find the Kth smallest and largest elements.

  • Ensure K is within the array's size to avoid errors.

  • Handle multiple test cases efficiently.

  • Consider edge cases like when N is small or K is at the extremes.

Asked in MakeMyTrip

1w ago

Q. Longest Duplicate Substring Problem Statement

You are provided with a string 'S'. The task is to determine the length of the longest duplicate substring within this string. Note that duplicate substrings can ov...read more

Ans.

Find the length of the longest duplicate substring in a given string.

  • Iterate through all possible substrings of the input string.

  • Use a rolling hash function to efficiently compare substrings.

  • Store the lengths of duplicate substrings and return the maximum length.

Asked in Flipkart

1w ago

Q. Longest Substring Without Repeating Characters Problem Statement

Given a string S of length L, determine the length of the longest substring that contains no repeating characters.

Example:

Input:
"abacb"
Output...read more
Ans.

Find the length of the longest substring without repeating characters in a given string.

  • Use a sliding window approach to keep track of the longest substring without repeating characters.

  • Use a hashmap to store the index of each character in the string.

  • Update the start index of the window when a repeating character is found.

  • Calculate the maximum length of the window as you iterate through the string.

  • Return the maximum length of the window as the result.

Asked in Paytm

1w ago

Q. Problem Statement: Parity Move

You have an array of integers, and your task is to modify the array by moving all even numbers to the beginning while placing all odd numbers at the end. The order within even and...read more

Ans.

Move all even numbers to the beginning and odd numbers to the end of an array.

  • Iterate through the array and swap even numbers to the front and odd numbers to the back.

  • Use two pointers, one starting from the beginning and one from the end, to achieve the desired arrangement.

  • Return the modified array with even numbers at the start and odd numbers at the end.

Asked in Amazon

1w ago

Q. Rotting Oranges Problem Statement

You are given a grid containing oranges where each cell of the grid can contain one of the three integer values:

  • 0 - representing an empty cell
  • 1 - representing a fresh orange...read more
Ans.

Find the minimum time required to rot all fresh oranges in a grid.

  • Create a queue to store the rotten oranges and their time of rotting.

  • Iterate through the grid to find all rotten oranges and add them to the queue.

  • Simulate the rotting process by checking adjacent cells and updating their status.

  • Track the time taken to rot all fresh oranges and return the result.

  • Handle edge cases like unreachable fresh oranges or already rotten oranges.

Asked in Amazon

1w ago

Q. Search in a Row-wise and Column-wise Sorted Matrix Problem Statement

You are given an N * N matrix of integers where each row and each column is sorted in increasing order. Your task is to find the position of ...read more

Ans.

Given a sorted N * N matrix, find the position of a target integer 'X'.

  • Iterate over rows and columns to search for the target integer 'X'.

  • Utilize the sorted nature of the matrix to optimize the search process.

  • Return the position of 'X' if found, else return '-1 -1'.

Q. Smallest Number with Given Digit Product

Given a positive integer 'N', find and return the smallest number 'M', such that the product of all the digits in 'M' is equal to 'N'. If such an 'M' is not possible or ...read more

Ans.

Find the smallest number whose digits multiply to a given number N.

  • Iterate through possible digits to form the smallest number with product equal to N

  • Use a priority queue to keep track of the smallest possible number

  • Check constraints to ensure the number fits in a 32-bit signed integer

Asked in Amazon

1w ago

Q. Subtree of Another Tree Problem Statement

Given two binary trees, T and S, determine whether S is a subtree of T. The tree S should have the same structure and node values as a subtree of T.

Explanation:

A subt...read more

Ans.

Determine if one binary tree is a subtree of another binary tree based on their structure and node values.

  • Traverse through the main tree and check if any subtree matches the second tree

  • Use recursion to compare nodes of both trees

  • Handle edge cases like empty trees or null nodes

  • Check if the root node of the second tree exists in the main tree

Asked in Flipkart

1w ago

Q. The Skyline Problem

Compute the skyline of given rectangular buildings in a 2D city, eliminating hidden lines and forming the outer contour of the silhouette when viewed from a distance. Each building is descri...read more

Ans.

Compute the skyline of given rectangular buildings in a 2D city, eliminating hidden lines and forming the outer contour of the silhouette.

  • Iterate through the buildings to find the critical points (start and end) of each building.

  • Sort the critical points based on x-coordinate and process them to find the skyline.

  • Merge consecutive horizontal segments of equal height in the output to ensure no duplicates.

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

Calculate your in-hand salary

Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary

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