Software Developer

7000+ Software Developer Interview Questions and Answers

Updated 17 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. Nth Fibonacci Number

Nth term of Fibonacci series F(n), where F(n) is a function, is calculated using the following formula -

 F(n) = F(n-1) + F(n-2), Where, F(1) = F(2) = 1 

Provided N you have to find out the ...read more

Frequently asked in, ,

Software Developer Interview Questions and Answers for Freshers

illustration image
Q3. Terms Of AP

Ayush is given a number ‘X’. He has been told that he has to find the first ‘X’ terms of the series 3 * ‘N’ + 2, which are not multiples of 4. Help Ayush to find it as he has not been able to answer....read more

Q4. Minimum Number of Platform Needed

You are given the arrival and departure times of N trains at a railway station in a day. You need to find the minimum of platforms required for the railway station such that no ...read more

Are these interview questions helpful?
Q5. Merge two sorted arrays

Ninja has been given two sorted integer arrays/lists ‘ARR1’ and ‘ARR2’ of size ‘M’ and ‘N’. Ninja has to merge these sorted arrays/lists into ‘ARR1’ as one sorted array. You may have to a...read more

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

Share interview questions and help millions of jobseekers 🌟

man-with-laptop
Q7. Form a Triangle

You are given an integer of array/list 'ARR' of length ‘N. You are supposed to return true if it is possible to construct at least one non-degenerate triangle using values of array/list as sides ...read more

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

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

Q10. Array Intersection

You have been given two integer arrays/list(ARR1 and ARR2) of size N and M, respectively. You need to print their intersection; An intersection for this problem can be defined when both the ar...read more

Ans.

The task is to find the intersection of two integer arrays/lists.

  • Read the number of test cases

  • For each test case, read the size and elements of the first array/list

  • Read the size and elements of the second array/list

  • Find the intersection of the two arrays/lists

  • Print the intersection elements in the order they appear in the first array/list

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

Q13. Search In Rotated Sorted Array

Aahad and Harshit always have fun by solving problems. Harshit took a sorted array consisting of distinct integers and rotated it clockwise by an unknown amount. For example, he to...read more

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

Q15. Wildcard Pattern Matching

Given a text and a wildcard pattern of size N and M respectively, implement a wildcard pattern matching algorithm that finds if the wildcard pattern is matched with the text. The matchi...read more

Q16. Missing Number

You are given an array/list ‘BINARYNUMS’ that consists of ‘N’ distinct strings which represent all integers from 0 to N in binary representation except one integer. This integer between 0 to ‘N’ w...read more

Q17. Pattern: Triangle of numbers

Ninja is given a pattern. Now he is asked to print the same pattern for any given ‘N’ number of rows.

For example, Pattern for ‘N’ = 4 will be. 1 232 34545 4567654 

Input Format:

The...read more
Q18. Triplets with Given Sum

You are given an array/list ARR consisting of N integers. Your task is to find all the distinct triplets present in the array which adds up to a given number K.

An array is said to have a...read more

Frequently asked in,
Q19. 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

Q20. Compress the String

Ninja has been given a program to do basic string compression. For a character that is consecutively repeated more than once, he needs to replace the consecutive duplicate occurrences with th...read more

Q21. Maximum Coins

You are given a two-dimensional matrix of integers of dimensions N*M, where each cell represents the number of coins in that cell. Alice and Bob have to collect the maximum number of coins. The fo...read more

Ans.

Given a matrix of coins, Alice and Bob have to collect maximum coins with certain conditions.

  • Alice starts from top left corner and Bob starts from top right corner

  • They can move to (i+1, j+1) or (i+1, j-1) or (i+1, j)

  • They have to collect all the coins that are present at a cell

  • If Alice has already collected coins of a cell, then Bob gets no coins if goes through that cell again

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

Q23. Fenwick Tree

You are given an array/list 'ARR' of ‘N’ integers, and ‘Q’ queries. Each query can be of two types:

Given 2 integers ‘L’,’R’ ( L>=0 and R

Given an index ‘i’ update the value of ARR[i] to a given int...read more

Q24. Move All Negative Numbers To Beginning And Positive To End

You are given an array 'ARR' consisting of 'N' integers. You need to rearrange the array elements such that all negative numbers appear before all posit...read more

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

Q26. Find Intersection of two unsorted arrays.

You have been given two integer arrays/list(ARR1 and ARR2) of size N and M, respectively. You need to print their intersection; An intersection for this problem can be d...read more

Q27. Square Root (Integral)

Given a number N, find its square root. You need to find and print only the integral part of square root of N.

For eg. if number given is 18, answer is 4.

Input format :
Integer N 
Output ...read more
Q28. 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, ,
Q29. 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
Q30. 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

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

Q32. Check Permutation

For a given two strings, 'str1' and 'str2', check whether they are a permutation of each other or not.

Permutations of each other
Two strings are said to be a permutation of each other when ei...read more
Q33. 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

Q34. 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
Q35. 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,

Q36. 1. what is the difference between exception and error. How did u solve the errors in the code deployment?

Ans.

Exception is a runtime error that can be handled, while error is a severe issue that cannot be handled.

  • Exceptions are caused by the program logic, while errors are caused by external factors like hardware failure or network issues.

  • Exceptions can be caught and handled using try-catch blocks, while errors require fixing the underlying issue.

  • Example of exception: NullPointerException. Example of error: Out of Memory Error.

  • To solve errors in code deployment, identify the root cau...read more

Q37. Arithmetic Subarrays

You are given an array ‘A’ of length ‘N’, you have to tell the number of arithmetic subarrays that exist in the array ‘A’.

An Arithmetic subarray is a subarray that has 3 or more elements an...read more

Ans.

Count the number of arithmetic subarrays in an array.

  • An arithmetic subarray has 3 or more elements with the same difference between consecutive elements.

  • Loop through the array and check for all possible subarrays with 3 or more elements.

  • If the difference between consecutive elements is the same, increment the count.

  • Return the count for each test case.

Q38. 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,
Q39. Count Good Subsets

You are given an array ‘ARR’ of size ‘N’ consisting of distinct elements. Your task is to find the total number of good subsets. A subset is called a good subset when you can rearrange the ele...read more

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

Q42. Sort Big List Dates

Mary is a party-loving girl of the 21st Generation. She loves to attend parties and events with her family and friends. But she is terrible at remembering the dates of these events.

Mary has ...read more

Q43. Battleship

A board can be divided in two halves which are to be given to two players and then you need to add ships for each players. Every player will get a chance to hit at any random point by missile and if ...read more

Q44. Cycle Detection in a Singly Linked List

You have given a Singly Linked List of integers, determine if it forms a cycle or not.

A cycle occurs when a node's next points back to a previous node in the list. The li...read more

Ans.

The task is to determine if a given singly linked list forms a cycle or not.

  • A cycle occurs when a node's next points back to a previous node in the list.

  • To solve this problem, we can use the Floyd's Cycle-Finding Algorithm.

  • The algorithm uses two pointers, one moving at a normal pace and the other moving twice as fast.

  • If there is a cycle, the fast pointer will eventually catch up to the slow pointer.

  • If the fast pointer reaches the end of the list (i.e., it encounters a null no...read more

Frequently asked in,
Q45. 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

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

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

Q49. Maximum sum subarray

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

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

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