Full Stack Developer
100+ Full Stack Developer Interview Questions and Answers for Freshers

Asked in DBS Bank

Q. Query and Matrix Problem Statement
You are given a binary matrix with 'M' rows and 'N' columns, initially consisting of all 0s. You will receive 'Q' queries, which can be of four types:
Query 1: 1 R index
Query ...read more
Given a binary matrix, perform queries to flip elements in rows/columns and count zeros in rows/columns.
Iterate through each query and update the matrix accordingly
For type 1 queries, flip the elements in the specified row/column
For type 2 queries, count the number of zeros in the specified row/column
Return the count of zeros for type 2 queries

Asked in Amazon

Q. LCA of Binary Tree Problem Statement
You are given a binary tree consisting of distinct integers and two nodes, X
and Y
. Your task is to find and return the Lowest Common Ancestor (LCA) of these two nodes.
The ...read more
Find the Lowest Common Ancestor of two nodes in a binary tree.
Traverse the binary tree to find the paths from the root to nodes X and Y.
Compare the paths to find the last common node, which is the Lowest Common Ancestor.
Implement a recursive function to find the LCA efficiently.
Handle edge cases such as when X or Y is the root node or when X or Y is not present in the tree.

Asked in Amazon

Q. Count Set Bits Problem Statement
Given a positive integer N
, compute the total number of '1's in the binary representation of all numbers from 1 to N. Return this count modulo 1e9+7 because the result can be ve...read more
Count the total number of set bits in the binary representation of numbers from 1 to N modulo 1e9+7.
Iterate through numbers from 1 to N and count the set bits in their binary representation
Use bitwise operations to count the set bits efficiently
Return the count modulo 1e9+7 for each test case

Asked in greytHR

Q. Most Frequent Non-Banned Word Problem Statement
Given a paragraph consisting of letters in both lowercase and uppercase, spaces, and punctuation, along with a list of banned words, your task is to find the most...read more
Find the most frequent word in a paragraph that is not in a list of banned words.
Split the paragraph into words and convert them to uppercase for case-insensitivity.
Count the frequency of each word, excluding banned words.
Return the word with the highest frequency in uppercase.

Asked in MakeMyTrip

Q. Reach the Destination Problem Statement
You are given a source point (sx, sy) and a destination point (dx, dy). Determine if it is possible to reach the destination point using only the following valid moves:
- ...read more
Determine if it is possible to reach the destination point from the source point using specified moves.
Use depth-first search (DFS) to explore all possible paths from source to destination.
Keep track of visited points to avoid infinite loops.
Check if the destination point is reachable by following the valid moves.
Return true if destination is reachable, false otherwise.

Asked in OodlesTechnologies

Q. Find a Node in Linked List
Given a singly linked list of integers, your task is to implement a function that returns the index/position of an integer value 'N' if it exists in the linked list. Return -1 if the ...read more
Implement a function to find the index of a given integer in a singly linked list.
Traverse the linked list while keeping track of the index of each element.
Compare each element with the target integer 'N'.
Return the index if the element is found, otherwise return -1.
Handle cases where the target integer is not found in the linked list.
Full Stack Developer Jobs




Asked in Amazon

Q. Add Two Numbers as Linked Lists
You are given two singly linked lists, where each list represents a positive number without any leading zeros.
Your task is to add these two numbers and return the sum as a linke...read more
Add two numbers represented as linked lists and return the sum as a linked list.
Traverse both linked lists simultaneously while keeping track of carry from previous sum
Create a new linked list to store the sum of the two numbers
Handle cases where one linked list is longer than the other by padding with zeros
Update the current node with the sum of corresponding nodes from both lists and carry

Asked in MakeMyTrip

Q. Maximum Distance Problem Statement
Given an integer array 'A' of size N, your task is to find the maximum value of j - i, with the restriction that A[i] <= A[j], where 'i' and 'j' are indices of the array.
Inpu...read more
Find the maximum distance between two elements in an array where the element at the first index is less than or equal to the element at the second index.
Iterate through the array and keep track of the minimum element encountered so far along with its index.
Calculate the maximum distance by subtracting the current index from the index of the minimum element.
Update the maximum distance if a greater distance is found while iterating.
Return the maximum distance calculated.
Share interview questions and help millions of jobseekers 🌟

Asked in Publicis Sapient

Q. Count Substrings with K Distinct Characters
Given a lowercase string 'STR' and an integer K, the task is to count all possible substrings that consist of exactly K distinct characters. These substrings are not ...read more
Count substrings with exactly K distinct characters in a given lowercase string.
Iterate through all substrings of length K and count distinct characters.
Use a set to keep track of distinct characters in each substring.
Increment count if number of distinct characters equals K.

Asked in Zopsmart Technology

Q. Find Indices for Local Minima and Maxima
Given an integer array arr
of size N
, your task is to determine all indices of local minima and local maxima within the array. Return these indices in a 2-D list, where ...read more
The task is to find and return the indices of local minima and local maxima in the given array.
Iterate through the array and compare each element with its neighbors to determine if it is a local minima or maxima.
Consider corner elements separately by comparing them with only one neighbor.
Store the indices of local minima and maxima in separate lists.
If there are no local minima or maxima, return -1 as the only row element in the 2-D list.

Asked in Samsung Research

Array Sum Calculation
Calculate the sum of all elements in an array of length N
.
Input:
Line 1: An integer N indicating the size of the array.
Line 2: N integers, the elements of the array, separated by spaces.
Calculate the sum of all elements in an array of length N.
Read the size of the array N and then read N integers as elements of the array.
Iterate through the array and add each element to a running total to calculate the sum.
Return the final sum as the output.

Asked in Amazon

Q. Count Inversions Problem Statement
Given an integer array ARR
of size N
, your task is to find the total number of inversions that exist in the array.
An inversion is defined for a pair of integers in the array ...read more
Count the total number of inversions in an integer array.
Iterate through the array and for each pair of elements, check if the inversion condition is met.
Use a nested loop to compare each pair of elements efficiently.
Keep a count of the inversions found and return the total count at the end.

Asked in CommVault

Q. Collect Maximum Coins from Matrix
You are provided with a matrix consisting of 'M' rows and 'N' columns. Each cell in this matrix either contains a coin or is empty.
Your task is to collect the maximum number o...read more
Given a matrix with coins and empty cells, collect maximum coins from boundary cells and adjacent cells.
Iterate through the boundary cells and collect coins from them and their adjacent cells
Keep track of visited cells to avoid collecting the same coin multiple times
Use depth-first search or breadth-first search to explore adjacent cells

Asked in Amazon

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
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 Standard Chartered

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
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

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
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.

Asked in Bounteous x Accolite

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
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

Asked in Tata 1mg

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
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.

Asked in Amazon

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
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

Asked in Amazon

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
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

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
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 Hewlett Packard Enterprise

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
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

Asked in Publicis Sapient

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
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 Avalara Technologies

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
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 Amazon

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
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 SAP

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
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

Asked in MakeMyTrip

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
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 Housing.com

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
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

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
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

Asked in TO THE NEW

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
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
Interview Questions of Similar Designations
Interview Experiences of Popular Companies





Top Interview Questions for Full Stack Developer Related Skills

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


Reviews
Interviews
Salaries
Users

