Associate Software Engineer
1500+ Associate Software Engineer Interview Questions and Answers
Given a singly linked list, you have to detect the loop and remove the loop from the linked list, if present. You have to make changes in the given linked list itself and return the update...read more
You are given a string EXP which is a valid infix expression. Convert the given infix expression to postfix expression.
Infix expression is of the form a op b. Where operator is is between the o...read more
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
You are Harshad Mehtaβs friend. He told you the price of a particular stock for the next βNβ days. You can either buy or sell a stock. Also, you can only complete at most 2-transactions. Find ...read more
You have been given an encoded string. Your task is to decode it back to the original string.
- An encoded string will be of the form [encoded_string], where the 'encoded_string' inside the square ...read more
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
Share interview questions and help millions of jobseekers π
For a given array with N elements, you need to find the length of the longest subsequence from the array such that all the elements of the subsequence are sorted in strictly increa...read more
Ninja has been given a string 'STR' containing only lowercase alphabetic characters. Ninja has to find the number of all the different possible substrings of size two that appear in 'STR' as...read more
The task is to find all the different possible substrings of size two that appear in a given string as contiguous substrings.
Iterate through the string and extract substrings of size two
Store the substrings in an array
Return the array of substrings
Associate Software Engineer Jobs
Q59. Question 2 was, Find the sum of all numbers in range from 1 to m(both inclusive) that are not divisible by n. Return difference between sum of integers not divisible by n with sum of numbers divisible by n.
Find sum of numbers in range 1 to m (both inclusive) not divisible by n. Return difference between sum of non-divisible and divisible numbers.
Iterate through range 1 to m and check if number is divisible by n.
If not divisible, add to sum of non-divisible numbers.
If divisible, add to sum of divisible numbers.
Return difference between sum of non-divisible and divisible numbers.
Implement a queue data structure which follows FIFO(First In First Out) property, using only the instances of the stack data structure.
Note:
1. To implement means you need to complete some pre...read more
You have been given an array/list ARR of length N consisting of 0s and 1s only. Your task is to find the number of subarrays(non-empty) in which the number of 0s and 1s are equal....read more
Given an array βARRβ of size βN,β swap the Kth element from beginning with the Kth element from the end.
For example:
If βNβ = 5 and K = 2 [1, 2, 3, 4, 5] Then the output will be [1, 4, 3, 2, 5...read more
Ninja is given a task to implement a priority queue using Heap data structure. The Ninja is busying preparing for the tournament., So he asked for your help.
Your task is to use the cl...read more
You have been given an array/list 'PREORDER' representing the preorder traversal of a BST with 'N' nodes. All the elements in the given array have distinct values.
Your task is to con...read more
Given a graph, check whether the graph is bipartite or not. Your function should return true if the given graph's vertices can be divided into two independent sets, βUβ and βVβ such that every ed...read more
The function checks whether a given graph is bipartite or not.
A bipartite graph can be divided into two independent sets such that every edge connects a vertex from one set to the other.
We can use graph coloring algorithm to check if the graph is bipartite.
Start by coloring the first vertex with one color and all its neighbors with the other color.
Continue coloring the remaining vertices, making sure that no adjacent vertices have the same color.
If at any point, we find that ...read more
Given a matrix βUNIVERSEβ with 3 rows and βNβ columns, with the characters { # , * , . } and these characters represent a cluster of stars and galaxies in space. Stars are represented by β*β symbol...read more
You are given a string S of length N. Your task is to find the index(considering 1-based indexing) of the first unique character present in the string. If there are no unique c...read more
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
The task is to merge two sorted arrays into one sorted array.
Create a new array with size M + N to store the merged array
Use two pointers to iterate through the elements of ARR1 and ARR2
Compare the elements at the current pointers and add the smaller element to the new array
Move the pointer of the array from which the element was added
Repeat the process until all elements are merged
If there are remaining elements in ARR2, add them to the new array
Return the merged array
You are given an integer 'N'. For a given 'N' x 'N' chessboard, find a way to place 'N' queens such that no queen can attack any other queen on the chessboard.
A queen can be killed when it lies in the ...read more
You are given a string STR of length N. Your task is to remove all the vowels present in that string and print the modified string.
English alphabets βaβ, βeβ, βiβ, βoβ, βuβ are termed as vowels. A...read more
Given a string (STR) of length N, you have to create a new string by performing the following operation:
Take the smallest character from the first 'K' characters of STR, remove it from STR...read more
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
The question asks to calculate 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 trapped water for all bars and return the total amount.
Given an array βAβ of size βNβ, sorted in non-decreasing order. Return the pair of two distinct indices whose value adds up to the given βtargetβ. The given array is 0 indexed. So returned indices are in...read more
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
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
You are given a Singly Linked List of integers and a reference to the node to be deleted. Every node of the Linked List has a unique value written on it. Your task is to delete that ...read more
You are given a string STR of length N. Your task is to remove all the vowels present in that string and print the modified string.
English alphabets βaβ, βeβ, βiβ, βoβ, βuβ are...read more
You have been given a string 'STR' of words. You need to replace all the spaces between words with β@40β.
Input Format:
The first line contains a single integer βTβ representing the number of test...read more
Take two numbers as input and swap them and print the swapped values.
Input Format:
The first line of input contains a single integer 't', representing the total number of test cases. The second...read more
You have given a sorted array 'A' of 'N' integers.
Now, you are given 'Q' queries, and each query consists of a single integer 'X'. Your task is to check whether 'X' is present in a...read more
Implement a Stack Data Structure specifically to store integer data using two Queues.
There should be two data members, both being Queues to store the data internally. You may use the inbuilt Q...read more
You are given a positive integer 'N'. Your task is to return all the prime numbers less than or equal to the 'N'.
Note:
1) A prime number is a number that has only two f...read more
You are given 'N' stones labeled from 1 to 'N'. The 'i-th' stone has the weight W[i]. There are 'M' colors labeled by integers from 1 to 'M'. The 'i-th' stone has the color C[i] which is an int...read more
Given an undirected and disconnected graph G(V, E), containing 'V' vertices and 'E' edges, the information about edges is given using 'GRAPH' matrix, where i-th edge is between GRAPH[i][0] and GRAP...read more
The question asks to print the DFS traversal of an undirected and disconnected graph.
Implement a Depth First Search (DFS) algorithm to traverse the graph.
Use a visited array to keep track of visited vertices.
For each unvisited vertex, start a DFS traversal and print the connected component.
Sort the vertices of each connected component in ascending order before printing.
You are given a Singly Linked List of integers with a head pointer. Every node of the Linked List has a value written on it.
A sample Linked List
Now you have been given an integer value...read more
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
The Employee table holds all employees including their managers. Every employee has an Id, and there is also a column for the manager Id as shown below:
+----+-------+--------+-----------+
| Id | Name...read more
You are given two arbitrary rectangles on a 2-D coordinate plane, which may have an intersecting area. You have to find the net area covered by both the rectangles on the car...read more
You are given two arbitrary binary trees consisting of N and M number of nodes respectively, your task is to check whether the two trees are mirror of each other or not.
Two trees a...read more
You're given string βSTRβ consisting solely of β{β, β}β, β(β, β)β, β[β and β]β . Determine whether the parentheses are balanced.
Input Format:
The first line contains an Integer 'T' which denot...read more
The task is to determine whether the given string of parentheses is balanced or not.
Use a stack data structure to check for balanced parentheses.
Iterate through the string and push opening parentheses onto the stack.
If a closing parenthesis is encountered, check if it matches the top of the stack.
If it matches, pop the top element from the stack.
If the stack is empty at the end, the parentheses are balanced.
If the stack is not empty or a closing parenthesis doesn't match, the...read more
1. He asked me what databases have you worked on?
2. What type of database is MySQL? I answered RDBMS.
He asked me to show the database design of a few of my projects. I did. Later he asked what is ...read more
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
You are given an arbitrary binary tree consisting of 'N' nodes where each node is associated with a certain value. You need to find out the height of the tree.
Height of a binary tree is th...read more
The height of a binary tree is the maximum number of edges from the root to a leaf node.
Traverse the tree recursively and keep track of the maximum height
If the current node is null, return 0
Otherwise, calculate the height of the left and right subtrees and return the maximum height plus 1
You have been given a linked list where each node has a single character. You have also been given a string 'STR'.
You have to remove all the occurrences of string STR from the linked list.
Note:
1...read more
You have been given a 2-D array 'MAT' of size M x N where 'M' and 'N' denote the number of rows and columns, respectively. The elements of each row are sorted in non-decreasing order.
Moreo...read more
You are given a N x M matrix of integers, print the spiral path of the matrix.
For example:
Input Format:
The first line contains an integer 'T' which denotes the number of test cases or queries t...read more
Q97. 1) What is NullPointerExceprion and give me a example?
NullPointerException is a runtime exception that occurs when a program tries to access or use an object reference that is null.
It is a common exception in Java programming.
It is thrown when a program attempts to use an object reference that has not been initialized.
It indicates that there is an attempt to access or invoke a method on an object that is null.
Example: String str = null; str.length();
You are given an integer, all you have to do is to find whether this number is a Fibonacci number or not.
Fn is said to be a Fibonacci sequence such that each number in Fn is the sum of its two ...read more
Given the head node of the singly linked list, return a pointer pointing to the middle of the linked list.
If there are an odd number of elements, return the middle element if t...read more
You have been given a grid containing some oranges. Each cell of this grid has one of the three integers values:
Interview Questions of Similar Designations
Top Interview Questions for Associate 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