Software Engineer

7000+ Software Engineer Interview Questions and Answers

Updated 24 Feb 2025
search-icon

Q51. Bubble Sort Problem Statement

Sort the given unsorted array consisting of N non-negative integers in non-decreasing order using the Bubble Sort algorithm.

Input:

The first line contains an integer 'T' represent...read more

Q52. Check Word Presence in String

Given a string S and a list wordList containing N distinct words, determine if each word in wordList is present in S. Return a boolean array where the value at index 'i' indicates ...read more

Q53. Merge Two Sorted Arrays Problem Statement

Given two sorted integer arrays ARR1 and ARR2 of size M and N, respectively, merge them into ARR1 as one sorted array. Assume that ARR1 has a size of M + N to hold all ...read more

Q54. Painting Fences Problem Statement

You are given β€˜N’ fences. Your task is to compute the total number of ways to paint these fences using only 2 colors, such that no more than 2 adjacent fences have the same col...read more

Are these interview questions helpful?

Q55. Find Row With Maximum 1's in a Sorted 2D Matrix

You are provided with a 2D matrix containing only the integers 0 or 1. The matrix has dimensions N x M, and each row is sorted in non-decreasing order. Your objec...read more

Q56. Longest Common Subsequence Problem Statement

Given two strings, S and T with respective lengths M and N, your task is to determine the length of their longest common subsequence.

A subsequence is a sequence tha...read more

Share interview questions and help millions of jobseekers 🌟

man-with-laptop

Q57. Merge K Sorted Arrays Problem Statement

Given 'K' different arrays that are individually sorted in ascending order, merge all these arrays into a single array that is also sorted in ascending order.

Input

The f...read more

Q58. String Compression Task

Develop an algorithm that compresses a string by replacing consecutive duplicate characters with the character followed by the count of its repetitions, if that count exceeds 1.

Example:...read more

Software Engineer Jobs

Software Engineer- Golang/Kubernetes β€’ 3-7 years
Red Hat India Pvt Ltd
β€’
4.3
Bangalore / Bengaluru
Software Engineer β€’ 2-5 years
Red Hat India Pvt Ltd
β€’
4.3
Pune
Software Engineer β€’ 1-3 years
Red Hat India Pvt Ltd
β€’
4.3
Pune

Q59. What are seven layers of networking?

Ans.

The seven layers of networking refer to the OSI model which defines how data is transmitted over a network.

  • The seven layers are: Physical, Data Link, Network, Transport, Session, Presentation, and Application.

  • Each layer has a specific function and communicates with the layers above and below it.

  • For example, the Physical layer deals with the physical transmission of data, while the Application layer deals with user interfaces and applications.

  • Understanding the OSI model is imp...read more

Q60. Merge Sort Problem Statement

You are given a sequence of numbers, ARR. Your task is to return a sorted sequence of ARR in non-descending order using the Merge Sort algorithm.

Explanation:

The Merge Sort algorit...read more

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

Frequently asked in,

Q62. Reverse Words in a String: Problem Statement

You are given a string of length N. Your task is to reverse the string word by word. The input may contain multiple spaces between words and may have leading or trai...read more

Q63. Left View of a Binary Tree Problem Statement

Given a binary tree, your task is to print the left view of the tree.

Example:

Input:
The input will be in level order form, with node values separated by a space. U...read more

Q64. Break The Integer Problem Statement

Given an integer N, the task is to divide this integer into 'K' positive parts (where K β‰₯ 2) such that their sum equals N. The objective is to maximize the product of these '...read more

Q65. Duplicate Characters in a String

Given a string 'S' of length 'N', identify and return all the characters in the string that appear more than once along with their frequency.

Example:

Input:
 N = 5
S = 'GEEK'
O...read more

Q66. Given an array A[n], write a C program to find P and Q (P>Q) such that A[P] - A[Q] is maximum

Ans.

C program to find P and Q (P>Q) such that A[P] - A[Q] is maximum

  • Iterate through array and keep track of maximum difference and corresponding indices

  • Initialize P and Q to first two elements and update as necessary

  • Time complexity: O(n)

Q67. Next Permutation Task

Design a function to generate the lexicographically next greater permutation of a given sequence of integers that form a permutation.

A permutation contains all integers from 1 to N exactl...read more

Q68. Wildcard Pattern Matching Problem Statement

Implement a wildcard pattern matching algorithm to determine if a given wildcard pattern matches a text string completely.

The wildcard pattern may include the charac...read more

Ans.

The task is to implement a wildcard pattern matching algorithm that checks if a given wildcard pattern matches a given text.

  • The wildcard pattern can include the characters '?' and '*'

  • '?' matches any single character

  • '*' matches any sequence of characters (sequence can be of length 0 or more)

  • The matching should cover the entire text, not partial text

  • Implement a function that takes the wildcard pattern and the text as input and returns True if the text matches the pattern, False...read more

Q69. Idempotent Matrix Verification

Determine if a given N * N matrix is an idempotent matrix. A matrix is considered idempotent if it satisfies the following condition:

M * M = M

Input:

The first line contains a si...read more

Q70. If there are 200 fishes in an aquarium. 99% are red. How many fishes have to be removed to make the red fishes 98 % in the aquarium?

Ans.

To make the red fishes 98%, 50 fishes have to be removed from the aquarium.

  • Calculate 1% of 200 fishes to find out how many fishes represent 1%.

  • Multiply the result by 2 to find out how many fishes represent 2%.

  • Subtract the result from 200 to find out how many fishes represent 98%.

Q71. Missing Number Problem Statement

You are provided with an array named BINARYNUMS consisting of N unique strings. Each string represents an integer in binary, covering every integer from 0 to N except for one. Y...read more

Q72. Intersection of Linked List Problem

You are provided with two singly linked lists containing integers, where both lists converge at some node belonging to a third linked list.

Your task is to determine the data...read more

Frequently asked in,

Q73. Nth Fibonacci Number Problem Statement

Calculate the Nth term in the Fibonacci sequence, where the sequence is defined as follows: F(n) = F(n-1) + F(n-2), with initial conditions F(1) = F(2) = 1.

Input:

The inp...read more
Frequently asked in, ,

Q74. Prime Numbers within a Range

Given an integer N, determine and print all the prime numbers between 2 and N, inclusive.

Input:

Integer N

Output:

Prime numbers printed on separate lines

Example:

Input:
N = 10
Out...read more

Q75. Pascal's Triangle Problem Statement

You are provided with an integer N. The objective is to return a 2-dimensional list representing Pascal’s triangle up to row N.

A Pascal's triangle is a triangular array wher...read more

Q76. Remove Character from String Problem Statement

Given a string str and a character 'X', develop a function to eliminate all instances of 'X' from str and return the resulting string.

Input:

The first line contai...read more

Q77. Topological Sort Problem Statement

You are given a directed acyclic graph (DAG). Your task is to perform topological sorting of the graph and return any valid ordering.

Explanation:

A directed acyclic graph is ...read more

Q78. Water Jug Problem Statement

You have two water jugs with capacities X and Y liters respectively, both initially empty. You also have an infinite water supply. The goal is to determine if it is possible to measu...read more

Q79. Loot Houses Problem Statement

A thief is planning to steal from several houses along a street. Each house has a certain amount of money stashed. However, the thief cannot loot two adjacent houses. Determine the...read more

Q80. Print All Permutations of a String

Given an input string STR, generate and print all possible permutations of the string.

Input:

str

Output:

All permutations of the input string, each on a new line.

Example:

In...read more

Q81. Boolean Matrix Transformation Challenge

Given a 2-dimensional boolean matrix mat of size N x M, your task is to modify the matrix such that if any element is 1, set its entire row and column to 1. Specifically,...read more

Q82. Cycle Detection in a Singly Linked List

Determine if a given singly linked list of integers forms a cycle or not.

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

Frequently asked in,

Q83. Railway Seat Berth Determination

Given a railway seat number represented as an integer, determine if it is a valid seat number and identify its berth type. Possible berth types include lower berth, middle berth...read more

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

Frequently asked in,

Q85. Armstrong Number Problem Statement

You are provided an integer 'NUM'. Determine if 'NUM' is an Armstrong number.

Explanation:

An integer 'NUM' with 'k' digits is an Armstrong number if the sum of its digits, ea...read more

Q86. Integer to Roman Conversion

Given an integer N, convert it to its corresponding Roman numeral representation. Roman numerals comprise seven symbols: I, V, X, L, C, D, and M.

Example:

Input:
N = 2
Output:
II
Exp...read more

Q87. Maximize Expression Value

Given an arithmetic expression EXP containing integer values separated by any of the operators β€˜+’, β€˜-’, and β€˜*’, your task is to place parentheses such that the value of the expressio...read more

Q88. Minimum Number of Platforms Needed Problem Statement

You are given the arrival and departure times of N trains at a railway station for a particular day. Your task is to determine the minimum number of platform...read more

Q89. Pythagorean Triplets Detection

Determine if an array contains a Pythagorean triplet by checking whether there are three integers x, y, and z such that x2 + y2 = z2 within the array.

Input:

The first line contai...read more

Q90. Swap Kth Elements in an Array

Given an array ARR of size N, perform the operation to swap the Kth element from the beginning with the Kth element from the end of the array.

Example:

Input:
N = 5, K = 2
ARR = [1,...read more

Q91. An API is running slow. Upon investigation it was found that SPROC running behind it is perfectly optimized. How can you debug this behavior of API? (You can neglect the resolve time & connect time of the API r...

read more
Ans.

To debug the slow behavior of the API, analyze network latency, check for database issues, monitor server performance, and review code for potential bottlenecks.

  • Analyze network latency to identify any issues with data transmission.

  • Check for database issues such as slow queries or insufficient indexing.

  • Monitor server performance to ensure it has enough resources and is not overloaded.

  • Review the code for potential bottlenecks, such as inefficient algorithms or excessive databas...read more

Q92. Left Rotations of an Array

You are given an array consisting of N elements and need to perform Q queries on that array. Each query consists of an integer indicating the number of elements by which the array sho...read more

Q93. Matrix Multiplication Task

Given two sparse matrices MAT1 and MAT2 of integers with dimensions 'N' x 'M' and 'M' x 'P' respectively, the goal is to determine the resulting matrix produced by their multiplicatio...read more

Q94. Sudoku Solver

Given a 9x9 Sudoku board, your task is to fill the empty slots and return the completed Sudoku solution.

A Sudoku is a grid composed of nine 3x3 smaller grids. The challenge is to fill in the numb...read more

Q95. What are the features of Java 8?

Q96. Character Frequency in Order of Occurrence

For the given string S of length N, determine the frequency of each character from 'a' to 'z' appearing within S.

Input:

The first input line contains an integer 'T' r...read more

Q97. Cube of Matrix Problem Statement

Given a 2D array 'MATRIX' of size M x N, find and return the value (i * i + j * j) for those elements where the sum of the cubes of its digits equals the element itself. Here, '...read more

Q98. Decimal to Octal Conversion Problem Statement

Convert a given decimal number into its equivalent octal representation.

Explanation:

The octal number system is a base-8 system, meaning each digit ranges from 0 t...read more

Q99. Interleaving Two Strings Problem Statement

You are given three strings 'A', 'B', and 'C'. Determine if 'C' is formed by interleaving 'A' and 'B'.

String 'C' is an interleaving of 'A' and 'B' if the length of 'C...read more

Q100. Longest Consecutive Sequence Problem Statement

You are provided with an unsorted array/list ARR of N integers. Your task is to determine the length of the longest consecutive sequence present in the array.

Expl...read more

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
Β β€’Β 10.5k Interviews
3.8
Β β€’Β 8.2k Interviews
3.6
Β β€’Β 7.6k Interviews
3.7
Β β€’Β 5.7k Interviews
3.8
Β β€’Β 5.6k Interviews
3.7
Β β€’Β 4.8k Interviews
3.5
Β β€’Β 3.9k Interviews
3.5
Β β€’Β 3.8k Interviews
3.8
Β β€’Β 3k Interviews
3.5
Β β€’Β 613 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 Engineer 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

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