Associate Software Engineer
400+ Associate Software Engineer Interview Questions and Answers for Freshers
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
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...read more
You have been given 'N' ropes of different lengths, we need to connect these ropes into one rope. The cost to connect two ropes is equal to sum of their lengths. We need to conn...read more
The problem is to connect N ropes of different lengths into one rope with minimum cost.
Sort the array of rope lengths in ascending order.
Initialize a variable to keep track of the total cost.
While there are more than one rope remaining, take the two shortest ropes and connect them.
Add the cost of connecting the two ropes to the total cost.
Replace the two shortest ropes with the connected rope.
Repeat the above steps until only one rope remains.
Return the total cost as the mini...read more
Ninja is given a few numbers, and he is being asked to rearrange the numbers so that every second element is greater than its left and right element.
Suppose the given array is [1, ...read more
The task is to rearrange the given array such that every second element is greater than its left and right element.
Read the number of test cases
For each test case, read the number of elements in the array and the array elements
Iterate through the array and swap elements at odd indices with their adjacent elements if necessary
Check if the rearranged array satisfies the conditions and print 1 if it does, else print 0
You are given a positive integer N. Your task is to find the smallest number whose factorial contains at least N trailing zeroes.
Example :
Let N = 1. ...read more
You are given an integer βNUMβ . Your task is to find out whether this number is an Armstrong number or not.
A k-digit number βNUMβ is an Armstrong number if and only if the k-th power of each d...read more
Share interview questions and help millions of jobseekers π
You are given two Singly Linked List of integers, which are merging at some node of a third linked list.
Your task is to find the data of the node at which merging starts. If there is...read more
You are given an array βArrβ consisting of βNβ distinct integers and a positive integer βKβ. Find out Kth smallest and Kth largest element of the array. It is guaranteed...read more
Associate Software Engineer Jobs
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 li...read more
You are given a string 'S'. Your task is to check whether the string is palindrome or not. For checking palindrome, consider alphabets and numbers only and ignore the symbols ...read more
You are given a Singly Linked List of integers and an integer 'K'.
Your task is to modify the linked list by inserting a new node after every 'K' node in the linked list with the node value being equ...read more
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
The question asks to find the minimum number of left shift operations required to obtain the longest common prefix of two given strings.
Perform left shift operations on string B to find the longest common prefix with string A
Count the number of left shift operations required to obtain the longest common prefix
Return the minimum number of left shift operations for each test case
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
You are given an integer array 'ARR' of size 'N' and an integer 'S'. Your task is to return the list of all pairs of elements such that each sum of elements of each pair equals 'S'.
Note:
Each pair shou...read more
You have been given three numbers βXβ, βYβ and βZβ. You have to find the sum of all the numbers formed by the combination of the digits 3, 4 and 5. You can use 3 at most βXβ times, 4 at most βYβ ...read more
You are given an array Arr consisting of N integers. You need to find the equilibrium index of the array.
An index is considered as an equilibrium index if the sum of elements of the array to t...read more
You are given a string 'STR' of lowercase English alphabets. You need to find the repeated character present first in the string.
Example:
If the string is: βabccbaβ, then the first repe...read more
Which number would replace the underline marked in the series 20, 40,100, ...., 820?
Given an integer βNβ representing the number of pairs of parentheses, Find all the possible combinations of balanced parentheses with the given number of pairs of parentheses.
Note :
Conditi...read more
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
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 there are ev...read more
Q22. One of the questions for Critical Reasoning was:- Two cars A and B cross a flyover in 10 minutes and 30 minutes respectively. Find the speed of Car A. Statements: Car B travels at the 50kmph Train A and B are t...
read moreCar A's speed is 90kmph
Use the formula: Speed = Distance/Time
Assume the distance to be the same for both cars
Calculate Car A's time using the given information
Substitute the values in the formula to get Car A's speed
You are given an integer array βARRβ. You have to find the length of the shortest contiguous subarray such that, if you sort this subarray in ascending order, then the whole array will be sorted in asce...read more
The question asks to find the length of the shortest contiguous subarray that needs to be sorted in order to sort the whole array.
Iterate through the array and find the first element that is out of order from the left side.
Iterate through the array and find the first element that is out of order from the right side.
Find the minimum and maximum element within the subarray from the above steps.
Expand the subarray from both sides until all elements within the subarray are in the...read more
You are given a Weighted Directed Acyclic Graph (DAG) consisting of βNβ nodes and βEβ directed edges. Nodes are numbered from 0 to βNβ-1. You are also given a source node βSrcβ in ...read more
You are given a binary tree with 'N' nodes. Your task is to return the size of the largest subtree of the binary tree which is also a BST.
A binary search tree (BST) is a binary tree data str...read more
You have been given two integers βDAY_HOURSβ and βPARTSβ. Where βDAY_HOURSβ is the number of hours in a day and a day can be divided into βPARTSβ equal parts. Your task is to find total instance...read more
You are given an array of n integers (a1, a2,....,an), you need to find if the array contains a pythagorean triplet or not.
An array is said to have a pythagorean triplet if there exists thr...read more
Given a string βSβ consisting of lower case English letters, you are supposed to return the longest palindromic substring of βSβ.
Note that in case of more than one longest palindro...read more
You are given the first term (A), the common ratio (R) and an integer N. Your task is to find the Nth term of the GP series.
The general form of a GP(Geometric Progression) series is A, A(R), A(R...read more
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
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
Q38. 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.
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
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
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 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
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 '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 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
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