Software Developer
6500+ Software Developer Interview Questions and Answers
For a given integer array/list 'ARR' of size 'N' containing all distinct values, find the total number of 'Inversions' that may exist.
An inversion is defined for a pair of integers in the array...read more
Bob has just turned 18 years old and has opened a Bank account. However, since he has just opened his bank account he is not very experienced about the working of banks, therefore he asks for your ...read more
Some players are put inside an ‘N’ x ‘M’ matrix ‘GRID’ one by one where:
- ‘.’ represents an empty cell.
- ‘#’ represents a wall.
- ‘@’ represents the starting point.
- Lower...read more
A thief is robbing a store and can carry a maximal weight of W into his knapsack. There are N items and the ith item weighs wi and is of value vi. Considering the constraints of the maximum weight t...read more
Given an array ‘ARR’ and an integer ‘K’, your task is to find all the count of all sub-arrays whose sum is divisible by the given integer ‘K’.
Note:
If there exists...read more
You are given an array 'ARR' of 'N' positive integers. You need to find the minimum number of operations needed to make all elements of the array equal. You can perform addition, mul...read more
Share interview questions and help millions of jobseekers 🌟
Given an array ‘A’ having ‘N’ integers and an integer ‘m’. You need to rearrange the array elements such that after re-arrangement difference of array elements with ‘m’ should be in a s...read more
You have been given a binary matrix of size 'N' * 'M' where each element is either 0 or 1. You are also given a source and a destination cell, both of them lie within the matrix....read more
Software Developer Jobs
You have been given a binary tree of 'N' unique nodes and a Start node from where the tree will start to burn. Given that the Start node will always exist in the tree, your task is to print the...read more
Two players 'X' and 'Y', are playing a coin game. Initially, there are 'N' coins. Each player can pick exactly 'A' coins or 'B' coins or 1 coin. A player los...read more
A Derangement is a permutation of ‘N’ elements, such that no element appears in its original position. For example, an instance of derangement of {0, 1, 2, 3} is {2, 3, 1, 0}, because 2 prese...read more
Write a function that calculates the corresponding day of the week for any particular date in the past or future.
For example, for the date 28th August 2020 happens to be Friday. Hence the expect...read more
You are given two arrays 'A' and 'B' of size 'N' and 'M' respectively. Both these arrays are sorted in non-decreasing order. You have to find the intersection of these two arrays.
Inte...read more
The problem is to find the intersection of two sorted arrays.
Use two pointers to iterate through the arrays.
Compare the elements at the current pointers and move the pointers accordingly.
If the elements are equal, add it to the intersection array and move both pointers.
If the element in the first array is smaller, move the first pointer.
If the element in the second array is smaller, move the second pointer.
Repeat until one of the pointers reaches the end of its array.
Return t...read more
For a given Binary Tree of type integer and a number X, find whether a node exists in the tree with data X or not.
Input Format:
The first line of each test case contains elements of the first...read more
Kevin has two packs of cards. The first pack has N cards and the second one has M cards. Every card has an integer written on it. Now, you have to tell two things. First, how many different t...read more
You have been given an N*M matrix filled with integer numbers, find the maximum sum that can be obtained from a path starting from any cell in the first row to any cell in the last...read more
Mike is a little boy who loves solving math problems. One day he was playing with his mom’s mobile. The mobile keypad contains 12 buttons { 10 digits(0-9) and 2 characters(‘*’ and ‘#’) }. Mike w...read more
You are given a bag of size 'W' kg and provided with the costs of packets with different weights of oranges as a list/array with the name 'cost'. Every i-th position in the cost denot...read more
You are given an array 'ARR' of 'N' positive integers. You need to find the minimum number of operations needed to make all elements of the array equal. You can perform addition, multiplicatio...read more
The minimum number of operations needed to make all elements of the array equal by performing addition, multiplication, subtraction, or division on any element.
Iterate through the array and find the maximum and minimum values
Calculate the difference between the maximum and minimum values
Check if the difference is divisible by the length of the array
If divisible, return the difference divided by the length
If not divisible, return the difference divided by the length plus one
You have been given a permutation of ‘N’ integers. A sequence of ‘N’ integers is called a permutation if it contains all integers from 1 to ‘N’ exactly once. Your task is to rearrange the number...read more
Given an integer array ‘ARR’ of length ‘N’, return the number of longest increasing subsequences in it.
The longest increasing subsequence(LIS) is the longest subsequence...read more
You are given a Binary Search Tree (BST) and a target value ‘K’. Your task is to check if there exist two unique elements in the given BST such that their sum is equal to the given target ‘K’.
A...read more
The task is to check if there exist two unique elements in the given BST such that their sum is equal to the given target 'K'.
Traverse the BST in-order and store the elements in a sorted array
Use two pointers, one at the beginning and one at the end of the array
Check if the sum of the elements at the two pointers is equal to the target 'K'
If the sum is less than 'K', move the left pointer to the right
If the sum is greater than 'K', move the right pointer to the left
Repeat the...read more
You are given an input string 'S'. Your task is to find and return all possible permutations of the input string.
Note:
1. The input string may contain the same characters, so there w...read more
You have been given a Binary Tree of integers.
Your task is to print the Right view of it.
The right view of a Binary Tree is a set of nodes visible when the tree is viewed from the Right side and th...read more
You have been given stock values/prices for N number of days. Every i-th day signifies the price of a stock on that day. Your task is to find the maximum profit which you can make by buying and sel...read more
Given a string, determine if it is a palindrome, considering only alphanumeric characters.
Palindrome
A palindrome is a word, number, phrase, or other sequences of characters which read the sam...read more
Given a string (STR) of length N, you have to create a new string by performing the following operation:
Take the smallest character from the first 'K' characters of STR, remove it from ST...read more
Given an M * N matrix, where the value at any cell denotes the height of that cell in a 2-D elevation map. You need to find the volume of water that can be trapped within it.
For a matrix = [...read more
You have been given a sentence ‘S’ in the form of a string and a word ‘W’, you need to find whether the word is present in the given sentence or not. The word must...read more
Wong is hungry and wants to eat tuna melt. He checks his pocket and finds that he has only a buck left. He asked Dr. Strange to lend him some money, for which Strange agrees but to get the money, Wong ...read more
You have been given the preorder and inorder traversal of a binary tree. Your task is to construct a binary tree using the given inorder and preorder tr...read more
The task is to construct a binary tree using the given inorder and preorder traversals.
Use the preorder traversal to determine the root of the binary tree
Use the inorder traversal to determine the left and right subtrees of the root
Recursively construct the left and right subtrees
Return the root node of the constructed binary tree
You have been given a singly Linked List of integers. Your task is to delete the middle node of this List.
Note:
1. If there is no middle node in the list to delete, return an empty list (i.e....read more
The task is to delete the middle node of a singly linked list of integers.
If the linked list is empty or has only one node, there is no middle node to delete.
To delete the middle node, we need to find the middle node and update the pointers of the previous and next nodes.
To find the middle node in one traversal, we can use two pointers - a slow pointer and a fast pointer.
The slow pointer moves one node at a time, while the fast pointer moves two nodes at a time.
When the fast ...read more
You are given an array 'nums' consisting of first N positive integers. But from the N integers, one of the integers occurs twice in the array, and one of the integers is mis...read more
Given a N * N matrix and the task is to check matrix is idempotent matrix or not.
See the sample input.
Idempotent matrix M follows the following property :
M*M = M
Input format :
Line 1 : Siz...read more
You are given a Binary Tree ‘root’. The given Binary Tree may or may not be a Binary Search Tree(BST) itself. Your task is to find the maximum sum of node values of any subtree that is a Binary S...read more
The task is to find the maximum sum of node values of any subtree that is a Binary Search Tree(BST).
Traverse the binary tree in a bottom-up manner
For each node, check if it forms a BST and calculate the sum of its subtree
Keep track of the maximum sum encountered so far
Return the maximum sum
There is a one-dimensional garden of length 'N'. On each of the positions from 0 to 'N', there is a fountain, and this fountain’s water can reach up to a certain range as explained further. In ...read more
You are given an array 'ARR' of integers. Your task is to modify the array so that all the array elements having zero values get pushed to the left and all the array elements having non-zero v...read more
You are present at point ‘A’ which is the top-left cell of an M X N matrix, your destination is point ‘B’, which is the bottom-right cell of the same matrix. Your task is to find the total num...read more
You are given a directed graph having ‘N’ nodes. A matrix ‘EDGES’ of size M x 2 is given which represents the ‘M’ edges such that there is an edge directed from node EDGES[i][0] ...read more
You are given an array 'ARR' of integers of length N. Your task is to find the first missing positive integer in linear time and constant space. In other words, find the lowest positive in...read more
There are ‘n’ fruit trees that are planted along a road. The trees are numbered from 0 to n-1. The type of fruit each tree bears is represented by an uppercase character of the English alphabe...read more
The problem is to find the maximum number of fruits the Ninja can put in both baskets after satisfying given conditions.
The Ninja can start at any tree and end at any tree, but cannot skip a tree.
He can pick one fruit from each tree until he cannot, i.e., when he has to pick a fruit of the third type.
The restriction is that each basket can have only one type of fruit.
We need to find the maximum number of fruits that can be put in both baskets.
We have a collection of 'N' stones, each stone has a positive integer weight.
On each turn, we choose the two heaviest stones and smash them together. Suppose the stones have weights 'x' and 'y...read more
This question is about finding the weight of the last stone after repeatedly smashing the two heaviest stones together.
Sort the array of stone weights in descending order.
Repeatedly smash the two heaviest stones together until there is at most 1 stone left.
If there is 1 stone left, return its weight. Otherwise, return 0.
You are given a matrix ‘ARR’ with ‘N’ rows and ‘M’ columns. Your task is to find the maximum sum rectangle in the matrix.
Maximum sum rectangle is a rectangle with the maximum value for the...read more
Ninja is organizing a meeting in an office that starts at a time ‘0’ and will end at a time ‘LAST’. There are ‘N’ presentations that are going to take place in that meeting whose start and end times are ...read more
You are given an array 'ARR' of 'N' positive integers. Your task is to find if we can partition the given array into two subsets such that the sum of elements in both subsets is equal....read more
You are given an array of integers. You need to sort the array in ascending order using quick sort.
Quick sort is a divide and conquer algorithm in which we choose a pivot point and partition the arr...read more
You have been given a sorted array/list ARR consisting of ‘N’ elements. You are also given an integer ‘K’.
Now the array is rotated at some pivot point unknown to you. For example,...read more
You have been given an array/list ARR consisting of ‘N’ elements. Each element in the array is either 0, 1 or 2.
Now, your task is to sort this array/list in increasing order. For ...read more
You are given a 2-D array 'MATRIX' of dimensions N x M, of integers. You need to return the spiral path of the matrix.
Example Of Spiral Path:
Input Format:
The first line contains an integer 'T' ...read more
Q200. A ball is left from a height of 10 meters. After bouncing first time it looses 10% of its previous height the next time it bounces. Write a code to calculate the number of bounces the ball goes through until it...
read moreCode to calculate number of bounces a ball goes through until it comes to rest.
Use a loop to simulate the bounces until the ball stops bouncing
Calculate the height of each bounce using the given formula
Keep track of the number of bounces in a counter variable
Interview Questions of Similar Designations
Top Interview Questions for Software Developer Related Skills
Interview experiences of popular companies
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/Month