Associate Software Engineer
1500+ Associate Software Engineer Interview Questions and Answers

Asked in Samsung

Q. 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
The task is to find all distinct triplets in an array that sum up to a specified number.
Iterate through the array and use nested loops to find all possible triplets.
Keep track of the triplets that sum up to the target number.
Handle cases where no triplet exists for a given target sum.

Asked in Hexaware Technologies

Q. Intersection of Two Arrays II
Given two integer arrays ARR1
and ARR2
of size N
and M
respectively, find the intersection of these arrays. An intersection refers to elements that appear in both arrays.
Note:
Inp...read more
Find the intersection of two integer arrays in the order they appear in the first array.
Iterate through the first array and store elements in a hashmap with their frequencies.
Iterate through the second array and check if the element exists in the hashmap, decrement frequency if found.
Return the elements that have non-zero frequencies as the intersection.
Associate Software Engineer Interview Questions and Answers for Freshers

Asked in Accenture

Q. Write a function to determine if a given string is a valid password based on the following criteria: - At least 4 characters - At least one numeric digit - At least one capital letter - Must not have space or s...
read moreValid password must have at least 4 characters, one numeric digit, one capital letter, no space or slash, and cannot start with a number.
Password must be at least 4 characters long
Password must contain at least one numeric digit
Password must contain at least one capital letter
Password cannot have space or slash (/)
Password cannot start with a number

Asked in Clarivate

Q. Best Time to Buy and Sell Stock II Problem Statement
Given the stock prices for a certain number of days, represented as an array, determine the maximum profit you can achieve. You may perform as many transacti...read more
The problem involves finding the maximum profit that can be achieved by buying and selling stocks on different days.
Iterate through the array of stock prices and find the local minima and maxima to calculate profit
Keep track of the total profit by adding the differences between consecutive maxima and minima
You can perform multiple transactions, so buy at each local minima and sell at each local maxima
Example: For prices = [7, 1, 5, 3, 6, 4], buy at 1, sell at 5, buy at 3, sel...read more

Asked in CGI Group

Q. Frog Jump Problem Statement
A frog is positioned on the first step of a staircase consisting of N
steps. The goal is for the frog to reach the final step, i.e., the N
th step. The height of each step is provided...read more
Calculate the minimal energy required for a frog to travel from the first step to the last step of a staircase.
Iterate through the staircase steps and calculate the energy cost for each jump.
Keep track of the minimum energy cost to reach each step.
Consider jumping either one step or two steps ahead to minimize energy cost.
Return the total minimal energy cost to reach the last step.

Asked in Amazon

Q. Connecting Ropes with Minimum Cost
You are given 'N' ropes, each of varying lengths. The task is to connect all ropes into one single rope. The cost of connecting two ropes is the sum of their lengths. Your obj...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
Associate Software Engineer Jobs




Asked in Micron Technology

Q. Add K Nodes Problem Statement
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. The value...read more
Modify a singly linked list by inserting a new node after every 'K' nodes with the sum of previous 'K' nodes.
Traverse the linked list while keeping track of 'K' nodes at a time
Calculate the sum of the 'K' nodes and insert a new node with the sum after every 'K' nodes
Handle the case where the number of remaining nodes is less than 'K' by inserting a node with the sum of remaining nodes
Update the pointers accordingly to maintain the linked list structure

Asked in NRI Financial Technologies

Q. Suppose you have to send an unbreakable box along with its key from Kolkata to Delhi such that no one in between can open the box and read the letter. You need to send both the lock and key; anyone getting both...
read moreUse a 3-way encryption method to securely send a box and key from Kolkata to Delhi.
1. Split the message into three parts: A, B, and C.
2. Encrypt part A with the recipient's public key.
3. Encrypt part B with the sender's public key.
4. Send parts A and B separately to the recipient.
5. Send part C unencrypted, as it contains no sensitive information.
6. The recipient can decrypt parts A and B using their private key and the sender's public key.
Share interview questions and help millions of jobseekers 🌟

Asked in Salesforce

Q. Factorial Trailing Zeros Problem
You are provided with a positive integer N. Your goal is to determine the smallest number whose factorial has at least N trailing zeros.
Example:
Input:
N = 1
Output:
5
Explanat...read more
Find the smallest number whose factorial has at least N trailing zeros.
Calculate the number of 5's in the prime factorization of the factorial to determine the trailing zeros.
Use binary search to find the smallest number with at least N trailing zeros.
Consider edge cases like N = 0 or N = 1 for factorial trailing zeros problem.

Asked in Hike

Q. Minimum Number of Swaps to Sort an Array
Find the minimum number of swaps required to sort a given array of distinct elements in ascending order.
Input:
T (number of test cases)
For each test case:
N (size of the...read more
The minimum number of swaps required to sort a given array of distinct elements in ascending order.
Use a sorting algorithm like bubble sort or selection sort to count the number of swaps needed
Track the swaps made during the sorting process to determine the minimum number of swaps
Optimize the sorting algorithm to reduce the number of swaps needed

Asked in ACKO

Q. Ninja and Alternating Largest Problem Statement
Ninja is given a sequence of numbers and needs to rearrange them so that every second element is greater than its neighbors on both sides.
Example:
Input:
[1, 2, ...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

Asked in NCR Corporation

Q. Sort By Kth Bit
Given an array or list ARR
of N
positive integers and an integer K
, your task is to rearrange all elements such that those with the K-th
bit (considering the rightmost bit as '1st' bit) equal to...read more
Rearrange elements in an array based on the value of the K-th bit, with 0s coming before 1s.
Iterate through the array and separate elements based on the K-th bit value.
Use bitwise operations to check the K-th bit of each element.
Maintain the relative order of elements within each group.
Combine the two groups to get the final rearranged array.

Asked in Amdocs

Q. Maximum Sum Increasing Subsequence of Length K Problem Statement
You are given an array NUMS
consisting of N integers and an integer K. Your task is to determine the maximum sum of an increasing subsequence of ...read more
Find the maximum sum of an increasing subsequence of length K in an array.
Iterate through the array and maintain a dynamic programming table to store the maximum sum of increasing subsequences of different lengths.
For each element, check all previous elements to find the increasing subsequences and update the maximum sum accordingly.
Return the maximum sum of the increasing subsequence of length K.
Example: For input [1, 2, 5, 4, 8] and K = 3, the maximum sum increasing subsequ...read more

Asked in Indiamart Intermesh

Q. 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
Generate and print all prime numbers between 2 and N, inclusive.
Iterate from 2 to N and check if each number is prime
A prime number is only divisible by 1 and itself
Print each prime number on a new line

Asked in Ericsson

Q. You are a team leader and one of your employees is unable to complete their work on time, causing you to be unable to submit the work before the deadline to your senior. How will you address this situation and...
read moreAs a team leader, I would identify the reason for the delay and work with the employee to find a solution to complete the work on time.
Have a one-on-one meeting with the employee to understand the reason for the delay
Identify any roadblocks or challenges the employee is facing and work together to find a solution
Set clear expectations and deadlines for the employee to complete the work
Provide support and resources to help the employee complete the work on time
Regularly check ...read more

Asked in Ernst & Young

Q. Intersection of Linked List Problem Statement
You are provided with two singly linked lists of integers. These lists merge at a node of a third linked list.
Your task is to determine the data of the node where ...read more
Given two linked lists, find the node where they intersect, if any.
Traverse both lists to find their lengths and the difference in lengths
Move the pointer of the longer list by the difference in lengths
Traverse both lists in parallel until they meet at the intersection node

Asked in Amdocs

Q. Reverse Stack with Recursion
Reverse a given stack of integers using recursion. You must accomplish this without utilizing extra space beyond the internal stack space used by recursion. Additionally, you must r...read more
Reverse a given stack of integers using recursion without using extra space or loop constructs.
Use recursion to pop all elements from the original stack and store them in function call stack.
Once the stack is empty, push the elements back in reverse order using recursion.
Ensure to handle base cases like empty stack or single element stack.
Example: If the input stack is [1, 2, 3], after reversal it should be [3, 2, 1].

Asked in Optum Global Solutions

Q. Shortest Path in Ninjaland
Ninjaland consists of ‘N’ states and ‘M’ paths. Each path connecting two states can either be a normal path or a special path, each with its unique length. Your task is to find the sh...read more
Find the shortest distance between two states in Ninjaland with at most one special path.
Use Dijkstra's algorithm to find the shortest path between two states.
Keep track of the shortest path with at most one special path included.
Consider both normal and special paths while calculating the shortest distance.
Handle cases where multiple paths exist between two states.

Asked in Accenture

Q. Two cars A and B cross a flyover in 10 minutes and 30 minutes respectively. Given that Car B travels at 50kmph and Train A and B are travelling in opposite directions, find the speed of Car A.
Car 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

Asked in Amazon

Q. Balanced Parentheses Combinations
Given an integer N
representing the number of pairs of parentheses, find all the possible combinations of balanced parentheses using the given number of pairs.
Explanation:
Con...read more
Generate all possible combinations of balanced parentheses given the number of pairs.
Use backtracking to generate all valid combinations of balanced parentheses.
Keep track of the number of open and close parentheses used in each combination.
Recursively build the combinations by adding open parentheses if there are remaining, and then adding close parentheses if the number of open parentheses is greater than the number of close parentheses.
Example: For N = 2, valid combination...read more

Asked in DE Shaw

Q. Chocolate Distribution Problem
You are given an array/list CHOCOLATES
of size 'N', where each element represents the number of chocolates in a packet. Your task is to distribute these chocolates among 'M' stude...read more
Distribute chocolates among students to minimize the difference between the largest and smallest number of chocolates.
Sort the array of chocolates packets.
Use sliding window technique to find the minimum difference between the largest and smallest packets distributed to students.
Return the minimum difference as the output.

Asked in Amazon

Q. Kth Smallest and Largest Element Problem Statement
You are provided with an array 'Arr' containing 'N' distinct integers and a positive integer 'K'. Your task is to find the Kth smallest and Kth largest element...read more
Find the Kth smallest and largest elements in an array.
Sort the array and return the Kth element for smallest and (N-K+1)th element for largest.
Ensure K is within the array size to avoid out of bounds error.
Handle multiple test cases efficiently by iterating through each case.

Asked in Amazon

Q. Pair Sum Problem Statement
You are given an integer array 'ARR' of size 'N' and an integer 'S'. Your task is to find and return a list of all pairs of elements where each sum of a pair equals 'S'.
Note:
Each pa...read more
Find pairs of elements in an array that sum up to a given value, sorted in a specific order.
Iterate through the array and for each element, check if the complement (S - current element) exists in a hash set.
If the complement exists, add the pair to the result list.
Sort the result list based on the criteria mentioned in the problem statement.

Asked in Accenture

Q. 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
An Armstrong number is a number that is equal to the sum of its own digits raised to the power of the number of digits.
Iterate through each digit of the number and calculate the sum of each digit raised to the power of the total number of digits.
Compare the calculated sum with the original number to determine if it is an Armstrong number.
Return 'YES' if the number is an Armstrong number, 'NO' otherwise.

Asked in LinkedIn

Q. Combination Sum Problem Statement
Given three integers X
, Y
, and Z
, calculate the sum of all numbers that can be formed using the digits 3, 4, and 5. Each digit can be used up to a maximum of X
, Y
, and Z
times ...read more
Calculate the sum of all numbers that can be formed using the digits 3, 4, and 5 with given constraints.
Iterate through all possible combinations of 3, 4, and 5 based on the given constraints.
Calculate the sum of each combination and add them up.
Return the final sum modulo 10^9 + 7.

Asked in Bharti Airtel

Q. Longest Common Prefix After Rotation
You are given two strings 'A' and 'B'. While string 'A' is constant, you may apply any number of left shift operations to string 'B'.
Explanation:
Your task is to calculate ...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

Asked in Nagarro

Q. Equilibrium Index Problem Statement
Given an array Arr
consisting of N integers, your task is to find the equilibrium index of the array.
An index is considered as an equilibrium index if the sum of elements of...read more
Find the equilibrium index of an array where sum of elements on left equals sum on right.
Iterate through the array and calculate the total sum of all elements.
For each index, calculate the left sum and right sum and check if they are equal.
Return the index if found, otherwise return -1.

Asked in Amazon

Q. Anagram Pairs Verification Problem
Your task is to determine if two given strings are anagrams of each other. Two strings are considered anagrams if you can rearrange the letters of one string to form the other...read more
Determine if two strings are anagrams of each other by checking if they have the same characters in different order.
Create a frequency map of characters for both strings and compare them.
Sort both strings and compare if they are equal.
Use a dictionary to count the occurrences of each character in both strings and compare the dictionaries.

Asked in Samsung

Q. Reverse Linked List Problem Statement
Given a singly linked list of integers, your task is to return the head of the reversed linked list.
Example:
Input:
The given linked list is 1 -> 2 -> 3 -> 4 -> NULL.
Outp...read more
To reverse a singly linked list of integers, return the head of the reversed linked list.
Iterate through the linked list, reversing the pointers to point to the previous node instead of the next node.
Keep track of the previous, current, and next nodes while traversing the list.
Update the head of the reversed linked list to be the last element of the original list.

Asked in TCS

Q. Describe a time you had a conflict with a team member and were not allowed to change teams. How did you manage the situation and resolve the conflict?
Conflict resolution involves communication, empathy, and collaboration to find a mutually beneficial solution.
1. Open Communication: Initiate a private conversation to discuss the conflict openly and honestly.
2. Active Listening: Listen to their perspective without interrupting, showing that you value their opinion.
3. Find Common Ground: Identify shared goals or interests that both parties can agree on.
4. Focus on Solutions: Shift the conversation towards finding a resolution...read more
Interview Questions of Similar Designations
Interview Experiences of Popular Companies





Top Interview Questions for Associate Software Engineer Related Skills



Reviews
Interviews
Salaries
Users

