ACKO
10+ Bimal roy & Dooars Construction co. Interview Questions and Answers
Q1. Matrix Chain Multiplication Problem Statement
You are provided with a chain of matrices A1, A2, A3, ..., An. The goal is to determine the minimum number of scalar multiplications needed to multiply these matric...read more
The goal is to determine the minimum number of scalar multiplications needed to multiply a chain of matrices together.
Understand the matrix chain multiplication problem statement and how the dimensions of matrices are defined by the input array.
Implement a dynamic programming approach to find the minimum cost of matrix multiplication.
Consider the constraints provided and optimize the solution accordingly.
Test the solution with different input arrays to ensure correctness.
Focu...read more
Q2. Maximum Sum of Disjoint Pairs with Specific Difference
Given an array of integers and a number K
, your task is to form pairs of elements from the array such that the absolute difference between them is strictly...read more
Find maximum sum of disjoint pairs with specific difference in an array.
Sort the array in non-decreasing order.
Iterate through the array and form pairs with absolute difference less than K.
Keep track of the sum of disjoint pairs to maximize it.
Return the maximum sum obtained.
Q3. Move Zeros to Left Problem Statement
Your task is to rearrange a given array ARR
such that all zero elements appear at the beginning, followed by non-zero elements, while maintaining the relative order of non-z...read more
Rearrange an array such that all zero elements appear at the beginning, followed by non-zero elements, maintaining relative order of non-zero elements.
Iterate through the array and move all zero elements to the left side of the array while maintaining the relative order of non-zero elements.
Use two pointers approach to swap elements efficiently.
Ensure to solve the problem in linear time and constant space complexity.
Example: Input: [1, 1, 0, 2, 0], Output: [0, 0, 1, 1, 2]
Q4. Find All Pairs Adding Up to Target
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 the Target
.
Input:
The first line conta...read more
Find all pairs of elements in an array that add up to a given target.
Iterate through the array and for each element, check if the complement (target - current element) exists in a hash set.
If the complement exists, add the pair to the result. If not, add the current element to the hash set.
Handle cases where the same element is used twice in a pair (e.g., target = 6, array = [3, 3]).
Q5. Delete a Node from a Linked List
You are provided with a linked list of integers. Your task is to implement a function that deletes a node located at a specified position 'POS'.
Input:
The first line contains a...read more
Implement a function to delete a node from a linked list at a specified position.
Traverse the linked list to find the node at the specified position.
Update the pointers of the previous and next nodes to skip the node to be deleted.
Handle cases where the position is at the beginning or end of the linked list.
Ensure to free the memory of the deleted node to avoid memory leaks.
Q6. Increasing Subsegment Problem Statement
Given a sequence ARR
consisting of N
integers, your task is to identify the longest subsegment of ARR
, where you can change at most one number to make the subsegment stri...read more
Find the longest subsegment where at most one number can be changed to make it strictly increasing.
Iterate through the array and keep track of the longest increasing subsegment with at most one change.
If a number violates the increasing order, try changing it and check if the subsegment becomes strictly increasing.
Update the length of the longest subsegment found so far.
Return the length of the longest subsegment for each test case.
Q7. Move Zeros To Left
You are provided an array ARR
of integers. Your task is to rearrange this array such that all elements with zero values are moved to the left, and all non-zero elements follow them, preservin...read more
Rearrange array with zeros on the left and non-zeros on the right while maintaining original order.
Iterate through the array from right to left, moving non-zero elements to the end of the array.
Track the index where non-zero elements should be placed.
Fill the beginning of the array with zeros and the rest with non-zero elements in their original order.
Q8. Polynomial Simplification Problem Statement
You are provided with two arrays representing the coefficients and degrees of a polynomial expression. Your task is to simplify this polynomial into its general form ...read more
Simplify a polynomial expression by combining like terms and arranging them in descending order of degrees.
Iterate through the coefficients and degrees arrays to combine like terms
Create a new array to store the simplified polynomial in descending order of degrees
Return the simplified polynomial array
Q9. Rat in a Maze Problem Statement
Given a maze of size N * N
with a rat placed at the top-left corner, find and print all possible paths that the rat can take to reach the bottom-right corner. The rat can move le...read more
Find and print all possible paths for a rat to reach the bottom-right corner of a maze.
Create a recursive function to explore all possible paths in the maze.
Keep track of the current path and mark visited cells.
Return the paths as matrices with 1 for cells in the path and 0 for others.
Q10. Binary Tree Diameter Problem Statement
You are given a Binary Tree, and you need to determine the length of the diameter of the tree.
The diameter of a binary tree is the length of the longest path between any ...read more
The problem involves finding the diameter of a binary tree, which is the length of the longest path between any two end nodes in the tree.
Traverse the tree to find the longest path between two nodes.
Use recursion to calculate the diameter of the binary tree.
Keep track of the maximum diameter found during traversal.
Consider the height of the left and right subtrees to calculate the diameter.
Example: For the input 1 2 3 4 -1 5 6 -1 7 -1 -1 -1 -1 -1 -1, the diameter of the binar...read more
Designing an application like Instagram involves creating a platform for sharing photos and videos with social networking features.
Implement user profiles with the ability to upload, like, comment, and share photos/videos
Develop a news feed algorithm to display content based on user preferences and interactions
Include features like filters, hashtags, geotagging, and direct messaging
Integrate push notifications for likes, comments, and new followers
Ensure scalability and perfo...read more
Q12. Simple Tree Traversal Problem LC medium
Given a binary tree, return the inorder traversal of its nodes' values.
Inorder traversal: left subtree, root, right subtree
Use recursion to traverse the tree
Implement a stack-based iterative solution for better space complexity
More about working at ACKO
Interview Process at Bimal roy & Dooars Construction co.
Top Software Developer Intern Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month