Software Developer

7000+ Software Developer Interview Questions and Answers

Updated 17 Dec 2024

Popular Companies

search-icon
Q51. Rahul And Minimum Subarray

Rahul is a programming enthusiast. He is currently learning about arrays/lists. One day his teacher asked him to solve a very difficult problem. The problem was to find the length of ...read more

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

Q53. Chocolate Pickup

Ninja has a 'GRID' of size 'R' X 'C'. Each cell of the grid contains some chocolates. Ninja has two friends Alice and Bob, and he wants to collect as many chocolates as possible with the help of...read more

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

Are these interview questions helpful?
Q55. 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

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

Share interview questions and help millions of jobseekers 🌟

man-with-laptop
Q57. 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

Q58. Triple Sum

It was Todd’s Birthday, So Bojack decided to give Todd a Binary tree with ‘N’ nodes. But the binary tree was too big to keep in his house, so Bojack decided to give exactly three nodes from that tree ...read more

Ans.

The task is to determine if it is possible to select three nodes from a binary tree such that their sum equals a given value.

  • Traverse the binary tree and store all the node values in an array

  • Use three nested loops to iterate through all possible combinations of three nodes

  • Check if the sum of the three nodes equals the given value

  • If a valid combination is found, return True

  • If no valid combination is found, return False

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
Q59. Weighted Job Scheduling

You are given 'N' jobs with their start time 'Start', end time 'End' and profit 'Profit'. You need to tell the maximum profit you can obtain by performing these jobs such that no two jobs...read more

Q60. System Design Question

Given a list of [FileName, FileSize, [Collection]] - Collection is optional, i.e., a collection can have 1 or more files.

Same file can be a part of more than 1 collection. How would you d...read more

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

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

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

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

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

Q68. Fire in the cells.

You are given a matrix 'MAT' of size ‘N’ * ‘M’, where ‘N’ is the number of rows and ‘M’ is the number of columns. Value ‘0’ in a cell represents that the cell is set on fire initially, (at tim...read more

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

Q70. Minimum Time in Wormhole Network

You will be given a starting point (sx, sy) and a destination point (dx, dy) in the two-dimensional coordinate system representing the universe.

Your spacecraft can move only in ...read more

Q71. 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
Q72. 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
Q73. Remove Duplicates From String

You are given a string (STR) of length N, consisting of only the lower case English alphabet.

Your task is to remove all the duplicate occurrences of characters in the string.

For E...read more
Q74. Rotting Oranges

You have been given a grid containing some oranges. Each cell of this grid has one of the three integers values:

  • Value 0 - representing an empty cell.
  • Value 1 - representing a fresh orange.
  • ...read more
  • Q75. Longest Substring Without Repeating Characters

    Given a string 'S' of length 'L', return the length of the longest substring without repeating characters.

    Example:

    Suppose given input is "abacb", then the length ...read more
    Frequently asked in,
    Q76. Make Array Elements Equal

    You are given an array of integers of size ‘N’. You have to make the elements of the array equal, and the cost of changing the element ‘x’ to ‘y’ is abs(x -y). Your task is to find the ...read more

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

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

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

    Q80. Count Inversions

    For a given integer array/list 'ARR' of size 'N', find the total number of 'Inversions' that may exist.

    An inversion is defined for a pair of integers in the array/list when the following two co...read more

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

    Q82. Distance Of Nearest Cell Having 1 In A Binary Matrix

    You have been given a binary matrix 'MAT' containing only 0’s and 1’s of size N x M. You need to find the distance of the nearest cell having 1 in the matrix ...read more

    Ans.

    Given a binary matrix, find the distance of the nearest cell having 1 in the matrix for each cell.

    • Use BFS to traverse the matrix and find the nearest cell having 1 for each cell.

    • Initialize the output matrix with maximum possible distance.

    • If the current cell has 1, distance is 0, else update distance based on the nearest cell having 1.

    Q83. Find prime numbers

    You are given a positive integer ‘N’. Your task is to print all prime numbers less than or equal to N.

    Note: A prime number is a natural number that is divisible only by 1 and itself. Example ...read more

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

    Q85. Reverse Words In A String

    You are given a string of length N. You need to reverse the string word by word. There can be multiple spaces between two words and there can be leading or trailing spaces but in the ou...read more

    Q86. Second largest element in the array

    You have been given an array/list 'ARR' of integers. Your task is to find the second largest element present in the 'ARR'.

    Note:
    a) Duplicate elements may be present. b) If no...read more
    Q87. 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

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

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

    Q90. Chocolate Problem

    Given an array/list of integer numbers 'CHOCOLATES' of size 'N', where each value of the array/list represents the number of chocolates in the packet. There are ‘M’ number of students and the t...read more

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

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

    Q93. Maximum sum of non-adjacent elements

    You are given an array/list of ‘N’ integers. You are supposed to return the maximum sum of the subsequence with the constraint that no two elements are adjacent in the given...read more

    Q94. Minimize the maximum difference between adjacent elements in an array

    You are given a non-decreasing array and an integer K. You need to remove exactly K integers from the given array such that the maximum diff...read more

    Q95. Rectangular Numbers

    Ninja has a number ‘N’. He wants to print the pattern in such a way that the outer rectangle is of the number ‘N’ and the number goes on decreasing as we move inside the rectangles.

    For examp...read more

    Q96. Reverse The Array

    Given an array with N elements, the task is to reverse all the array elements and print the reversed array.

    Input Format:

    The first line contains an integer N representing the size of the array...read more
    Q97. Shuffle Two Strings

    You are given three strings “A”, “B” and “C”. Your task is to check whether “C” is formed by an interleaving of A and B. C is said to be interleaving “A” and “B”, if the length of “C” is equa...read more

    Q98. Smallest Window

    You are given two strings S and X containing random characters. Your task is to find the smallest substring in S which contains all the characters present in X.

    Example:

    Let S = “abdd” and X = “b...read more
    Frequently asked in,

    Q99. There is a 12 km road and a contractor who is in-charge of repairing it. Contractor updates you about the work which is done in patches. Like “Road between 3.2 km to 7.9 km repaired ”, “Road between 1.21 km to ...

    read more
    Ans.

    The longest continuous patch of a road repaired by a contractor is determined.

    • Iterate through the updates and keep track of the start and end points of each patch

    • Calculate the length of each patch and update the longest patch if necessary

    • Return the start and end points of the longest patch

    Q100. Two Sum

    You are given an array of integers 'ARR' of length 'N' and an integer Target. Your task is to return all pairs of elements such that they add up to Target.

    Note:

    We cannot use the element at a given inde...read more
    Frequently asked in,
    Previous
    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