Senior Software Engineer
3500+ Senior Software Engineer Interview Questions and Answers
Popular Companies
Q1. Nth Prime Number Problem Statement
Find the Nth prime number given a number N.
Explanation:
A prime number is greater than 1 and is not the product of two smaller natural numbers. A prime number has exactly two...read more
The task is to find the Nth prime number given a number N.
A prime number is a number greater than 1 that is not a product of two smaller natural numbers.
Prime numbers have only two factors - 1 and the number itself.
Start with a counter at 0 and a number at 2.
Increment the number by 1 and check if it is prime.
If it is prime, increment the counter.
Repeat until the counter reaches N.
Return the last prime number found.
Q2. Pascal's Triangle Construction
You are provided with an integer 'N'. Your task is to generate a 2-D list representing Pascal’s triangle up to the 'N'th row.
Pascal's triangle is a triangular array where each el...read more
Senior Software Engineer Interview Questions and Answers for Freshers
Q3. K Largest Elements Problem Statement
You are given an integer k
and an array of integers that contain numbers in random order. Write a program to find the k
largest numbers from the given array. You need to sav...read more
Given an unsorted array, find the K largest elements in non-decreasing order.
Sort the array in non-decreasing order.
Return the last K elements of the sorted array.
Q4. Buy and Sell Stock Problem Statement
Imagine you are Harshad Mehta's friend, and you have been given the stock prices of a particular company for the next 'N' days. You can perform up to two buy-and-sell transa...read more
Q5. Tell me about yourself. What technology are you using? What is a Collection? What are the different types of collection there? What is the difference between ArrayList and LinkedList What are the basic building...
read moreThe interview questions cover a wide range of topics including software engineering, technology, design patterns, databases, web development, and more.
The questions cover topics such as technology used, collections, streams, design patterns, dependency injection, microservices, database communication, annotations in Spring, React and JavaScript, Redux, API development, SOAP-based web services, Jenkins, Docker, production support, and more.
Some specific questions include the d...read more
Q6. 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
Share interview questions and help millions of jobseekers 🌟
Q7. MapSum Pair Implementation
Create a data structure named 'MapSum' with the ability to perform two operations and a constructor.
Explanation:
MapSum()
: Initializes the MapSum.insert(...read more
The question asks to implement a data structure called 'MapSum' with functions to initialize, insert key-value pairs, and find the sum of values with a given prefix.
Implement a class called 'MapSum' with a constructor to initialize the data structure.
Implement the 'insert' function to insert key-value pairs into the 'MapSum'. If a key is already present, replace its value with the new one.
Implement the 'sum' function to find the sum of values whose key has a prefix equal to t...read more
Q8. Digits Decoding Problem Statement
A few days back, Ninja encountered a string containing characters from ‘A’ to ‘Z’ which indicated a secret message. For security purposes, he encoded each character of the stri...read more
Senior Software Engineer Jobs
Q9. Reverse the String Problem Statement
You are given a string STR
which contains alphabets, numbers, and special characters. Your task is to reverse the string.
Example:
Input:
STR = "abcde"
Output:
"edcba"
Input...read more
The task is to reverse a given string containing alphanumeric and special characters.
Iterate through the string from the last character to the first character
Append each character to a new string to get the reversed string
Return the reversed string as the output
Q10. Secret Message Decoding Problem
Ninja encountered an encoded secret message where each character from 'A' to 'Z' is mapped to a numeric value (A = 1, B = 2, ..., Z = 26). Given a numeric sequence (SEQ) derived ...read more
Q11. Excel Column Number Conversion
Given a column title as it appears in an Excel sheet, your task is to return its corresponding column number.
Example:
Input:
S = "AB"
Output:
28
Explanation:
The sequence is as f...read more
Q12. LRU Cache Design Question
Design a data structure for a Least Recently Used (LRU) cache that supports the following operations:
1. get(key)
- Return the value of the key if it exists in the cache; otherwise, re...read more
Q13. 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
Q14. Character Counting Challenge
Create a program that counts and prints the total number of specific character types from user input. Specifically, you need to count lowercase English alphabets, numeric digits (0-...read more
Q15. Number of Bit Flips Problem Statement
Ninja is practicing binary representations and stumbled upon an interesting problem. Given two numbers 'A' and 'B', you are required to determine how many bits need to be f...read more
Q16. Sum of Digits Problem Statement
Given an integer 'N', continue summing its digits until the result is a single-digit number. Your task is to determine the final value of 'N' after applying this operation iterat...read more
Q17. String Palindrome Verification
Given a string, your task is to determine if it is a palindrome considering only alphanumeric characters.
Input:
The input is a single string without any leading or trailing space...read more
Q18. Search In Rotated Sorted Array Problem Statement
Given a sorted array of distinct integers that has been rotated clockwise by an unknown amount, you need to search for a specified integer in the array. For each...read more
Q19. Find All Anagrams Problem Statement
Given a string STR and a non-empty string PTR, identify all the starting indices of anagrams of PTR within STR.
Explanation:
An anagram of a string is another string that can...read more
Q20. Boundary Traversal of a Binary Tree
Given a binary tree of integers, your task is to return the boundary nodes of the tree in Anti-Clockwise direction starting from the root node.
Input:
The first line contains...read more
Q21. How to apply SOLID principle and what is dependency injection and why to use it and scenarios on where to use
SOLID principles ensure maintainable and scalable code. Dependency Injection helps in achieving loose coupling and testability.
SOLID principles are Single Responsibility, Open-Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion
Dependency Injection is a design pattern that allows objects to be loosely coupled and easily testable
Use Dependency Injection to reduce tight coupling between classes and make them more modular
Use SOLID principles to ensure mai...read more
Q22. Anagram Substring Search
Given two strings 'STR' and 'PTR', identify all starting indices of 'PTR' anagram substrings in 'STR'. Two strings are anagrams if one can be rearranged to form the other.
Input:
First ...read more
Q23. LRU Cache Design Problem Statement
Design and implement a data structure for a Least Recently Used (LRU) cache that supports the following operations:
get(key)
- Retrieve the value associated with the specifie...read more
The question is about designing and implementing a data structure for LRU cache to support get and put operations.
LRU cache is a cache replacement policy that removes the least recently used item when the cache reaches its capacity.
The cache is initialized with a capacity and supports get(key) and put(key, value) operations.
For each get operation, return the value of the key if it exists in the cache, otherwise return -1.
For each put operation, insert the value in the cache i...read more
Q24. 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
Q25. Triplets with Given Sum Problem
Given an array or list ARR
consisting of N
integers, your task is to identify all distinct triplets within the array that sum up to a specified number K
.
Explanation:
A triplet i...read more
Q26. Anagram Pairs Verification
In this task, you need to verify if two provided strings are anagrams of each other. Two strings are considered anagrams if you can rearrange the letters of one string to form the oth...read more
Q27. Given a grid containing 0s and 1s and source row and column, in how many ways, could we reach form source to target. ( 1's represents a blockade and 0's represent accessable points)
Count the number of ways to reach target from source in a grid with 0s and 1s.
Use dynamic programming to solve the problem efficiently.
Traverse the grid using DFS or BFS to count the number of ways.
Consider edge cases like when source and target are the same or when there is no path.
Example: Given grid = [[0,0,0],[0,1,0],[0,0,0]], source = (0,0), target = (2,2), answer is 2.
Example: Given grid = [[0,1],[0,0]], source = (0,0), target = (1,1), answer is 1.
Q28. K-th Largest Number in a BST
Given a binary search tree (BST) consisting of integers and containing 'N' nodes, your task is to find and return the K-th largest element in this BST.
If there is no K-th largest e...read more
Q29. Reverse Linked List in Groups of K
You are provided with a linked list containing 'N' nodes and an integer 'K'. The task is to reverse the linked list in groups of size K, which means reversing the nodes in eac...read more
Q30. Trailing Zeros in Factorial Problem
Find the number of trailing zeroes in the factorial of a given number N
.
Input:
The first line contains an integer T
representing the number of test cases.
Each of the followi...read more
Q31. Reverse Alternate K Nodes Problem Statement
You are given a singly linked list of integers along with a positive integer 'K'. The task is to modify the linked list by reversing every alternate 'K' nodes of the ...read more
Q32. Count Ways to Reach the N-th Stair Problem Statement
You are provided with a number of stairs, and initially, you are located at the 0th stair. You need to reach the Nth stair, and you can climb one or two step...read more
Q33. Find Duplicates in an Array
Given an array ARR
of size 'N', where each integer is in the range from 0 to N - 1, identify all elements that appear more than once.
Return the duplicate elements in any order. If n...read more
Q34. Kth Largest Number Problem Statement
You are given a continuous stream of numbers, and the task is to determine the kth largest number at any moment during the stream.
Explanation:
A specialized data structure ...read more
Q35. Reverse String Word-Wise Problem Statement
Reverse the given string so that the last word appears first, the second last word appears second, and so on, while keeping the individual words unchanged.
Explanation...read more
Q36. Trapping Rain Water Problem Statement
Given a long type array/list ARR
of size N
, representing an elevation map where ARR[i]
denotes the elevation of the ith
bar, calculate the total amount of rainwater that ca...read more
Q37. Write a Program Nth term in a infinite series example: 2,4,8,2,4,8……..n…….infinite
Program to find the Nth term in an infinite series
The series has a repeating pattern
Use modulo operator to find the index of the repeating pattern
Calculate the value of Nth term based on the pattern
Q38. Preorder Traversal Problem Statement
You are provided with the root node of a binary tree comprising N
nodes. Your objective is to output its preorder traversal. Preorder traversal of a binary tree is performed...read more
Q39. Count Inversions Problem Statement
Given an integer array ARR
of size N
, your task is to find the total number of inversions that exist in the array.
An inversion is defined for a pair of integers in the array ...read more
Q40. Make Unique Array Challenge
Your task is to determine the minimum number of elements that need to be removed from an array 'ARR' of size 'N' such that all the remaining elements are distinct. In simpler terms, ...read more
Q41. Maximum Non-Adjacent Subsequence Sum
Given an array of integers, determine the maximum sum of a subsequence without choosing adjacent elements in the original array.
Input:
The first line consists of an integer...read more
Q42. Number of Islands Problem Statement
You are provided with a 2-dimensional matrix having N
rows and M
columns, containing only 1s (land) and 0s (water). Your goal is to determine the number of islands in this ma...read more
Q43. Move Zeroes to End
Given an unsorted array of integers, rearrange the elements such that all the zeroes are moved to the end, while maintaining the order of non-zero elements.
Input:
The first line contains an ...read more
Q44. All Paths From Source Lead To Destination Problem Statement
In a directed graph with 'N' nodes numbered from 0 to N-1, determine whether every possible path starting from a given source node (SRC) eventually le...read more
Q45. Asteroid Collision Problem Description
Given an array/list ASTEROIDS
representing asteroids aligned in a row, each element's absolute value identifies the asteroid's size, while its sign indicates the direction...read more
Q46. String Transformation Problem
Given a string (STR
) of length N
, you are tasked to create a new string through the following method:
Select the smallest character from the first K
characters of STR
, remove it fr...read more
Q47. Reverse String Operations Problem Statement
You are provided with a string S
and an array of integers A
of size M
. Your task is to perform M
operations on the string as specified by the indices in array A
.
The ...read more
Q48. In azure data factory how would you implement the functionality of tumbling window without actually using that feature already available?
Implementing tumbling window in Azure Data Factory without using the feature
Create a pipeline with a trigger that runs at the desired interval
Use a lookup activity to retrieve the data for the current window
Use a foreach activity to iterate over the retrieved data
Perform the required operations on the data within the foreach activity
Write the output to the desired destination
Q49. String is immutable but what happens if we assign another value to that string reference
Assigning another value to a string reference creates a new string object in memory.
Assigning a new value to a string reference creates a new string object in memory
The original string object remains unchanged
The new value is stored in a different memory location
The old value may be garbage collected if there are no other references to it
Interview Questions of Similar Designations
Top Interview Questions for Senior Software Engineer 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