Software Developer
1000+ Software Developer Interview Questions and Answers for Freshers
Q1. Maximum Subarray Sum Problem Statement
Given an array of integers, determine the maximum possible sum of any contiguous subarray within the array.
Example:
Input:
array = [34, -50, 42, 14, -5, 86]
Output:
137
E...read more
Q2. Crazy Numbers Pattern Challenge
Ninja enjoys arranging numbers in a sequence. He plans to arrange them in 'N' rows such that:
- The first row contains 1 number.
- The second row contains 2 numbers.
- The third row c...read more
Q3. 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
The task is to find the duplicate element in an array of integers.
Iterate through the array and keep track of the frequency of each element using a hash map.
Return the element with a frequency greater than 1.
Alternatively, sort the array and check for adjacent elements with the same value.
Q4. Greatest Common Divisor Problem Statement
You are tasked with finding the greatest common divisor (GCD) of two given numbers 'X' and 'Y'. The GCD is defined as the largest integer that divides both of the given...read more
Q5. Connect Ropes Problem Statement
Given a number of ropes denoted as 'N' and an array containing the lengths of these ropes, your task is to connect the ropes into one single rope. The cost to connect two ropes i...read more
Q6. Validate Binary Tree Nodes Problem
You are provided with 'N' binary tree nodes labeled from 0 to N-1, where node i has two potential children, recorded in the LEFT_CHILD[i]
and RIGHT_CHILD[i]
arrays. Determine ...read more
The task is to determine if the given binary tree nodes form exactly one valid binary tree.
Check if there is only one root node (a node with no parent)
Check if each node has at most one parent
Check if there are no cycles in the tree
Check if all nodes are connected and form a single tree
Share interview questions and help millions of jobseekers π
Q7. Ninja and the New Year Guests Problem
Ninja has organized a new year party and wants to verify if the guests are programmers by challenging them with a coding task. As an invited programmer, you're tasked to so...read more
Q8. Permutation in String Problem Statement
Determine if the string str2
contains a permutation of the string str1
as one of its substrings.
Input:
The first line contains an integer 'T', representing the number of...read more
Software Developer Jobs
Q9. Reverse Linked List Problem Statement
Given a singly linked list of integers, return the head of the reversed linked list.
Example:
Initial linked list: 1 -> 2 -> 3 -> 4 -> NULL
Reversed linked list: 4 -> 3 -> 2...read more
Q10. Sort 0s, 1s, and 2s Problem Statement
You are provided with an integer array/list ARR
of size 'N' which consists solely of 0s, 1s, and 2s. Your task is to write a solution to sort this array/list.
Input:
The fi...read more
Q11. Structurally Unique Binary Trees of Dragon Balls
Goku has βNβ Dragon Balls, where each Dragon Ball is unique. The ith Dragon Ball has βiβ stars on it, meaning the first Dragon Ball has 1 star, the second has 2 ...read more
Q12. Minimum Operations to Make Strings Equal
Given two strings, A
and B
, consisting of lowercase English letters, determine the minimum number of pre-processing moves required to make string A
equal to string B
usi...read more
Q13. Palindromic Substrings Problem Statement
You are given a string 'STR'. Your task is to determine the total number of palindromic substrings present in 'STR'.
Example:
Input:
"abbc"
Output:
5
Explanation:
The pa...read more
Q14. 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
Q15. Trapping Rain Water Problem Statement
You are given a long type array/list ARR
of size N
, representing an elevation map. The value ARR[i]
denotes the elevation of the ith
bar. Your task is to determine the tota...read more
The question asks to find the total amount of rainwater that can be trapped in the given elevation map.
Iterate through the array and find the maximum height on the left and right side of each bar.
Calculate the amount of water that can be trapped on each bar by subtracting its height from the minimum of the maximum heights on both sides.
Sum up the amount of water trapped on each bar to get the total amount of rainwater trapped.
Q16. Find K'th Character of Decrypted String
You are given an encrypted string where repeated substrings are represented by the substring followed by its count. Your task is to find the K'th character of the decrypt...read more
Q17. Maximum Subarray Problem Statement
Ninja has been given an array, and he wants to find a subarray such that the sum of all elements in the subarray is maximum.
A subarray 'A' is considered greater than a subarr...read more
Q18. Biggest Number Formation Problem
Your task is to construct the largest number possible by concatenating each of the provided positive integers in the array exactly once.
Input:
Integer T denoting the number of ...read more
Q19. Flip Bits Problem Explanation
Given an array of integers ARR
of size N, consisting of 0s and 1s, you need to select a sub-array and flip its bits. Your task is to return the maximum count of 1s that can be obta...read more
Q20. Linear Search Problem Statement
Given a random integer array/list ARR
of size N
, and an integer X
, you are required to search for the integer X
in the given array/list using Linear Search.
Return the index at w...read more
Q21. Maximum Equal Elements After K Operations
You are provided with an array/list of integers named 'ARR' of size 'N' and an integer 'K'. Your task is to determine the maximum number of elements that can be made eq...read more
Q22. Painter's Partition Problem Statement
Given an array/list representing boards, where each element denotes the length of a board, and a number βKβ of available painters, determine the minimum time required to pa...read more
Q23. Beautiful String Problem Statement
Given a binary string STR
containing either '0' or '1', determine the minimum number of operations needed to make it beautiful. A binary string is called beautiful if it conta...read more
Q24. Balanced Binary Trees Problem Statement
You are provided with an integer 'H'. Your task is to determine and print the maximum number of balanced binary trees possible with height 'H'.
A balanced binary tree is ...read more
The maximum number of balanced binary trees possible with a given height is to be counted and printed.
A balanced binary tree is one in which the difference between the left and right subtree heights is less than or equal to 1.
The number of balanced binary trees can be calculated using dynamic programming.
The number of balanced binary trees with height 'H' can be obtained by summing the product of the number of balanced binary trees for each possible left and right subtree hei...read more
Q25. Order of People Heights Problem Statement
Consider 'N' individuals numbered from 0 to N-1 standing in a queue. You are provided with two arrays: Height
and Infront
, each consisting of 'N' non-negative integers....read more
The task is to find the actual order of people in a queue based on their heights and the number of taller people in front of them.
Iterate through the given arrays and create a list of tuples containing the height and number of taller people for each person.
Sort the list of tuples in descending order of height and ascending order of the number of taller people.
Create an empty result list and insert each tuple into the result list at the index specified by the number of taller ...read more
Q26. Palindromic Numbers Finder
Given an integer 'N', your task is to identify all palindromic numbers from 1 to 'N'. These are numbers that read the same way forwards and backwards.
Input:
The first line provides a...read more
Q27. Tower Building Problem Statement
Given an array 'ARR' of 'N' cubes, you need to construct towers such that each cube can either be placed on top of an existing tower or start a new one. The restriction is that ...read more
Q28. Count Ways to Climb Stairs Problem
Given a staircase with a certain number of steps, you start at the 0th step, and your goal is to reach the Nth step. At every step, you have the option to move either one step...read more
Q29. Delete Alternate Nodes from a Singly Linked List
Given a Singly Linked List of integers, remove all the alternate nodes from the list.
Input:
The first and the only line of input will contain the elements of th...read more
Q30. Tiling Problem Statement
Given a board with 2 rows and N columns, and an infinite supply of 2x1 tiles, determine the number of distinct ways to completely cover the board using these tiles.
You can place each t...read more
Q31. Balanced Sequence After Replacement
Given a string of length 'N' containing only the characters: '[', '{', '(', ')', '}', ']'. At certain places, the character 'X' appears in place of any bracket. Your goal is ...read more
Q32. Duplicate Integer in Array
Given an array ARR
of size N
, containing each number between 1 and N-1
at least once, identify the single integer that appears twice.
Input:
The first line contains an integer, 'T', r...read more
Q33. Multiples of 2 and 3 Problem Statement
Ninja is engaged in a task involving divisors. He is given 'N' numbers, and his objective is to compute the sum of all numbers which are divisible by either 2 or 3.
Exampl...read more
Q34. Ninja Competition Problem Statement
Ninja is organizing a coding competition where two teams compete at a time. To keep it fair and interesting, both teams must have an equal number of members. Ninjaβs task is ...read more
Q35. Nth Fibonacci Number Problem Statement
Given an integer 'N', the task is to compute the N'th Fibonacci number using matrix exponentiation. Implement and return the Fibonacci value for the provided 'N'.
Note:
Si...read more
Q36. Shopping Spree Problem Statement
Preeti plans to shop for her father's birthday at a store with unlimited quantities of N different items. She has a budget that allows her to buy a maximum of K items. Help Pree...read more
Q37. Wave Array Sorting Problem
Your goal is to sort a given unsorted array ARR
such that it forms a wave array.
Explanation:
After sorting, the array should satisfy the wave pattern conditions:
ARR[0] >= ARR[1]
AR...read more
The task is to sort an array in a wave form, where each element is greater than or equal to its adjacent elements.
Iterate through the array and swap adjacent elements if they do not follow the wave pattern
Start from the second element and compare it with the previous element, swap if necessary
Continue this process until the end of the array
Repeat the process for the remaining elements
Return the sorted wave array
Q38. Dice Throws Problem Statement
You are given D
dice, each having F
faces numbered from 1 to F
. The task is to determine the number of possible ways to roll all the dice such that the sum of the face-up numbers e...read more
Q39. Longest Common Prefix After Rotation
You are given two strings 'A' and 'B'. While string 'A' is constant, you may apply any number of left shift operations to string 'B'.
Explanation:
Your task is to calculate ...read more
Q40. Alien Dictionary Problem Statement
You are provided with a sorted dictionary (by lexical order) in an alien language. Your task is to determine the character order of the alien language from this dictionary. Th...read more
Q41. Alternate Print Problem Statement
Given two strings A
and B
, your task is to print these two strings in an alternating sequence by indices. That is, the first character of 'A', the first character of 'B', follo...read more
Q42. Buses Origin Problem Statement
You have been provided with an array where each element specifies the number of buses that can be boarded at each respective bus stop. Buses will only stop at locations that are m...read more
Q43. First Unique Character in a Stream Problem Statement
Given a string A
consisting of lowercase English letters, determine the first non-repeating character at each point in the stream of characters.
Example:
Inp...read more
Q44. Largest Cycle in Maze Problem Statement
Given a maze represented by 'N' cells numbered from 0 to N-1, and an array arr
of 'N' integers where arr[i]
denotes the cell number that can be reached from the 'i'-th ce...read more
Q45. Maximum Sum of Non-Adjacent Elements
Given an array/list of βNβ integers, your task is to return the maximum sum of the subsequence where no two elements are adjacent in the given array/list.
Example:
Input:
T ...read more
Q46. Minimize Maximum Difference Between Adjacent Elements
You are provided with a non-decreasing array and an integer K. Your task is to remove exactly K elements from this array so that the maximum difference betw...read more
Q47. Shuffle Two Strings Problem Statement
You are provided with three strings A
, B
, and C
. The task is to determine if C
is formed by interleaving A
and B
. C
is considered an interleaving of A
and B
if:
- The length...read more
Q48. K-th Permutation Sequence Problem Statement
Given two integers N
and K
, your task is to find the K-th permutation sequence of numbers from 1 to N
. The K-th permutation is the K-th permutation in the set of all ...read more
Q49. Morty's Array Challenge
Rick has provided Morty with an array 'Arr' of length 'N' and an integer 'K'. Morty needs to split the array into non-empty sub-arrays to achieve the minimum possible cost, subject to th...read more
Q50. Rabbit Jumping Problem
Consider 'n' carrots numbered from 1 to 'n' and 'k' rabbits. Each rabbit jumps to carrots only at multiples of its respective jumping factor Aj (i.e., Aj, 2Aj, 3Aj, ...), for all rabbits ...read more
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