Software Developer

1500+ Software Developer Interview Questions and Answers for Freshers

Updated 15 Dec 2024

Popular Companies

search-icon
Q1. Maximum Subarray Sum

Given an array of numbers, find the maximum sum of any contiguous subarray of the array.

For example, given the array [34, -50, 42, 14, -5, 86], the maximum sum would be 137, since we would ...read more

Q2. Crazy Numbers

Ninja loves playing with numbers. So one day, he wants to arrange a few numbers in the ‘N’ number of rows. The first row contains 1 number, the second row has two numbers, the third row has 3 digit...read more

Q3. Find Duplicate in Array

You are given an array of integers 'ARR' containing N elements. Each integer is in the range [1, N-1], with exactly one element repeated in the array.

Your task is to find the duplicate e...read more

Ans.

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

You are given two numbers, ‘X’ and ‘Y’. Your task is to find the greatest common divisor of the given two numbers.

The Greatest Common Divisor of any two integers is the largest number th...read more

Are these interview questions helpful?
Q5. Find Palindromes

You are given an integer ‘N’. Your task is to find all palindromic numbers from 1 to ‘N’.

Palindromic integers are those integers that read the same backward or forwards.

Note:
Order of numbers ...read more
Q6. Connect Ropes

Given a number of ropes say ‘N’ and an array of integers of size ‘N’ containing the length of ropes. Your task is to connect the ropes into one. The cost to connect two ropes is equal to the sum of...read more

Share interview questions and help millions of jobseekers 🌟

man-with-laptop
Q7. Validate Binary Tree Nodes

You are given ‘N’ binary tree nodes numbered from 0 to N - 1 where node ‘i’ has two children LEFT_CHILD[i] and RIGHT_CODE[i]. Return ‘True’ if and only if all the given nodes form exac...read more

Ans.

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

Q8. Puzzle

Q1. How do we measure forty-five minutes using two identical wires, each of which takes an hour to burn? We have matchsticks with us. The wires burn non-uniformly.

Q2.You have 5 jars of pills. Each pill we...read more

Software Developer Jobs

Software Developer (Angular,.Net,C#) 3-9 years
Siemens Healthcare
4.4
Bangalore / Bengaluru
Software Developer 2-5 years
IBM India Pvt. Limited
4.1
Bangalore / Bengaluru
Software Developer 2-5 years
IBM India Pvt. Limited
4.1
Bangalore / Bengaluru
Q9. Ninja And The New Year Guests

Ninja has organized the new year party and invited all the programmers for it, as being the programmer also has been invited by Ninja.

To detect whether the guest is a programmer or...read more

Q10. Permutation in String

You have been given two strings ‘str1’ and ‘str2’ of length N and M respectively. Your task is to check whether string ‘str2’ contains one of the permutations of string ‘str1’ as its substr...read more

Q11. Reverse Linked List

Given a singly linked list of integers. Your task is to return the head of the reversed linked list.

For example:
The given linked list is 1 -> 2 -> 3 -> 4-> NULL. Then the reverse linked lis...read more
Frequently asked in, ,
Q12. Sort 0 1 2

You have been given an integer array/list(ARR) of size 'N'. It only contains 0s, 1s and 2s. Write a solution to sort this array/list.

Note :
Try to solve the problem in 'Single Scan'. ' Single Scan' ...read more
Q13. Goku and Dragon Balls

Goku has ‘N’ Dragon Balls. Each Dragon Ball is unique with the ith Dragon Ball having ‘i’ stars on it. For example, the first Dragon Ball has 1 star, the second Dragon Ball has 2 stars, and...read more

Q14. Maximum Subarray Sum

You are given an array (ARR) of length N, consisting of integers. You have to find the sum of the subarray (including empty subarray) having maximum sum among all subarrays.

A subarray is a ...read more

Q15. Minimum operations to make strings equal

You have been given two strings A and B consisting of lower case English letters. The task is to count the minimum number of pre-processing moves on the string A require...read more

Q16. Palindromic Substrings

You have been given a string STR. Your task is to find the total number of palindromic substrings of STR.

Example :
If the input string is "abbc", then all the possible palindromic substri...read more
Q17. Ways To Make Coin Change

You are given an infinite supply of coins of each of denominations D = {D0, D1, D2, D3, ...... Dn-1}. You need to figure out the total number of ways W, in which you can make a change fo...read more

Frequently asked in,
Q18. Trapping Rain Water

You have been given a long type array/list 'ARR' of size 'N'. It represents an elevation map wherein 'ARR[i]' denotes the elevation of the 'ith' bar. Print the total amount of rainwater that ...read more

Ans.

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.

Frequently asked in,
Q19. Find K’th Character of Decrypted String

You have been given an Encrypted String where repetitions of substrings are represented as substring followed by the count of substrings.

Example: String "aabbbcdcdcd" wil...read more
Q20. Maximum subarray

Ninjas has been given an array. He wants to find a subarray such that the sum of all elements in the subarray is maximum.

Subarray 'A' is greater than sub-array 'B' if sum(A) > sum(B). If two su...read more

Q21. Flip Bits

You are given an array of integers ARR[] of size N consisting of zeros and ones. You have to select a subset and flip bits of that subset. You have to return the count of maximum one’s that you can obt...read more

Q22. Form the Biggest Number

Given an array “A” of positive integers. Your task is to make the largest number possible formed by concatenating each of the array elements exactly once.

Example:
Let's say the given arr...read more
Q23. Linear Search

You have been given a random integer array/list(ARR) of size N, and an integer X. You need to search for the integer X in the given array/list using 'Linear Search'.

You have been required to retu...read more

Q24. Maximum equal elements after K operations

You are given an arbitrary array/list of integers 'ARR' of size ‘N’ and an integer ‘K’. You need to find the maximum number of elements which can be made equal to each o...read more

Q25. Painter's Partition Problem

Given an array/list of length ‘N’, where the array/list represents the boards and each element of the given array/list represents the length of each board. Some ‘K’ numbers of painter...read more

Q26. Beautiful String

Ninja has been given a binary string ‘STR’ containing either ‘0’ or ‘1’. A binary string is called beautiful if it contains alternating 0s and 1s.

For Example:‘0101’, ‘1010’, ‘101’, ‘010’ are be...read more

Q27. Count Special Nodes in Generic Tree

Given a generic tree, find the count of all special nodes. A node is a special node if there is a path from root to that node with all distinct elements. The input was not a p...read more

Q28. Balanced Binary Tree

You are given an integer 'H'. Your task is to count and print the maximum number of balanced binary trees possible with height 'H'.

The balanced binary tree is one in which, for every node, ...read more

Ans.

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

Q29. Order of People Heights

There are ‘N’ people numbered from 0 to N - 1, standing in a queue. You are given two arrays ‘Height’ and ‘Infront‘ consisting of ‘N’ non-negative integers. ‘Height[i]’ gives the height o...read more

Ans.

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

Q30. Towers

You are given ‘N’ cubes in an array ‘ARR’ in a certain order, and your task is to build towers using them. Whenever two cubes are on top of the other, the upper cube must be smaller than the lower cube.

Y...read more

Q31. Count ways to reach the nth stairs

You have been given a number of stairs. Initially, you are at the 0th stair, and you need to reach the Nth stair. Each time you can either climb one step or two steps. You are ...read more

Q32. Delete alternate nodes

Given a Singly Linked List of integers, delete all the alternate nodes in the list.

Example:
List: 10 -> 20 -> 30 -> 40 -> 50 -> 60 -> null Alternate nodes will be: 20, 40, and 60. Hence a...read more
Q33. Maximum Subarray Sum

You are given an array/list ARR consisting of N integers. Your task is to find the maximum possible sum of a non-empty subarray(contagious) of this array.

Note: An array C is a subarray of a...read more

Frequently asked in,
Q34. Ninja Competition

Our hero Ninja is organizing a coding competition where only two teams can participate simultaneously. To make the competition interesting and fair, both the teams should have an equal number o...read more

Q35. Tiling Problem

You have been given a board where there are '2' rows and 'N' columns. You have an infinite supply of 2x1 tiles, and you can place a tile in the following ways:

1. Horizontally as 1x2 tile 2. Verti...read more
Q36. Balanced Sequence After Replacement

You are given a string of length ‘N’ containing only the following characters: ‘[’, ‘{’, ‘(’, ‘)’, ‘}’, ‘]’. At some places, there is ‘X’ in place of any bracket. Your task is...read more

Q37. Duplicate in array

You are given an array ‘ARR’ of size ‘N’ containing each number between 1 and ‘N’ - 1 at least once. There is a single integer value that is present in the array twice. Your task is to find th...read more

Q38. Maximum Frequency Number

Ninja is given an array of integers that contain numbers in random order. He needs to write a program to find and return the number which occurs the maximum times in the given input. He ...read more

Frequently asked in,
Q39. Multiples of 2 and 3

Ninja is bored with his previous game of numbers, so now he is playing with divisors.

He is given 'N' numbers, and his task is to return the sum of all numbers which is divisible by 2 or 3.

...read more
Q40. Nth Fibonacci Number

You are given an integer ‘N’, your task is to find and return the N’th Fibonacci number using matrix exponentiation.

Since the answer can be very large, return the answer modulo 10^9 +7.

Fib...read more
Q41. Puzzle

1) You are at the side of a river. You are given a 3-litre jug and a 5-litre jug. Both the jugs are initially empty. The jugs don’t have markings to allow measuring smaller quantities. You have to use the...read more

Q42. Shopping Spree

Preeti has decided to go to the Grand Mall to buy some stuff for her father’s birthday. On reaching the place, she found a fascinating shop that has an unlimited quantity of each item they sell. T...read more

Q43. Sort an array in wave form

You have been given an unsorted array ‘ARR’.

Your task is to sort the array in such a way that the array looks like a wave array.

Example:
If the given sequence ‘ARR’ has ‘N’ elements ...read more
Ans.

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

Q44. Dice throws

You are given D dice, each having F faces numbered 1 to F, both inclusive. The task is to find the possible number of ways to roll the dice together such that the sum of face-up numbers equal the giv...read more

Q45. Longest Common Prefix After Rotation

You are given two strings 'A' and 'B' where string 'A' is fixed. But you can perform left shift operations on string B any number of times.

Your task is to find out the minim...read more

Q46. Alien dictionary

You have been given a sorted (lexical order) dictionary of an alien language. Write a function that finds the order of characters in the alien language. This dictionary will be given to you in t...read more

Q47. Alternate Print

You have two strings “A” and “B”. Your task is to print these two strings in an alternative fashion according to indices i.e. first character of “A”, the first character of “B”, the second charac...read more

Q48. Buses

You are given a vector of 'N' integers denoting the number of buses that can be boarded from the i-th position. The bus stops only at stops whose number is a multiple of the bus stop number from which the ...read more

Q49. First Unique Character in a String

You are given a string A consisting of lower case English letters. You have to find the first non-repeating character from each stream of characters.

For Example: If the given ...read more

Q50. Largest Cycle

You are given a maze consisting of N cells numbered from 0 to N - 1 and an array ‘arr’ of N integers in which arr[i] contains the cell number that can be reached from ‘i’th cell in one step. You ar...read more

1
2
3
4
5
6
7
Next
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Interview experiences of popular companies

3.7
 • 10k Interviews
3.9
 • 7.8k Interviews
3.7
 • 7.3k Interviews
3.8
 • 5.4k Interviews
3.7
 • 5.2k Interviews
4.1
 • 4.9k Interviews
3.8
 • 4.6k Interviews
3.7
 • 1.3k Interviews
3.8
 • 513 Interviews
4.3
 • 487 Interviews
View all

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

Software Developer Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

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

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter