Add office photos
Employer?
Claim Account for FREE

Arcesium

3.6
based on 297 Reviews
Video summary
Filter interviews by

10+ Baariz Technology Solutions Interview Questions and Answers

Updated 5 Feb 2024
Popular Designations

Q1. 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

Ans.

Given 'N' ropes of varying lengths, find the minimum cost to connect all ropes into one single rope.

  • Sort the lengths of ropes in ascending order.

  • Keep connecting the two shortest ropes at each step.

  • Update the total cost by adding the lengths of the connected ropes.

  • Repeat until all ropes are connected.

  • Return the total cost as the minimum cost to connect all ropes.

Add your answer

Q2. Ninja and Binary String Problem Statement

Ninja has a binary string S of size N given by his friend. The task is to determine if it's possible to sort the binary string S in decreasing order by removing any num...read more

Ans.

Determine if a binary string can be sorted in decreasing order by removing non-adjacent characters.

  • Check if the count of '1's in the string is equal to the length of the string, in which case it can be sorted in decreasing order.

  • If there are multiple '0's between two '1's, they can be removed to sort the string in decreasing order.

  • If there are more '0's than '1's, it is not possible to sort the string in decreasing order.

Add your answer

Q3. Maximum Meetings Problem Statement

Given the schedule of N meetings with their start time Start[i] and end time End[i], you need to determine which meetings can be organized in a single meeting room such that t...read more

Ans.

Given N meetings with start and end times, determine the maximum number of meetings that can be organized in a single room without overlap.

  • Sort the meetings based on their end times.

  • Iterate through the sorted meetings and select the first meeting that does not overlap with the previous one.

  • Repeat the process until all meetings are considered.

  • Return the selected meetings in the order they are organized.

Add your answer

Q4. Topological Sort Problem Statement

Given a Directed Acyclic Graph (DAG) consisting of V vertices and E edges, your task is to find any topological sorting of this DAG. You need to return an array of size V repr...read more

Ans.

Implement a function to find any topological sorting of a Directed Acyclic Graph (DAG).

  • Use Depth First Search (DFS) to traverse the graph and add vertices to the result in reverse order of finishing times.

  • Maintain a visited array to keep track of visited vertices to avoid revisiting them.

  • Start DFS from any unvisited vertex and recursively explore its neighbors.

  • Once all neighbors are visited, add the current vertex to the result.

  • Repeat the process until all vertices are visite...read more

Add your answer
Discover Baariz Technology Solutions interview dos and don'ts from real experiences

Q5. BST to Greater Tree Problem Statement

Given a binary search tree (BST) with 'N' nodes, the task is to convert it into a Greater Tree.

A Greater Tree is defined such that every node's value in the original BST i...read more

Ans.

Convert a binary search tree into a Greater Tree by replacing each node's value with the sum of all values greater than or equal to it.

  • Traverse the BST in reverse inorder (right, root, left) to visit nodes in descending order.

  • Keep track of the running sum of visited nodes and update each node's value with this sum.

  • Recursively apply the above steps to all nodes in the BST.

  • Example: Input - 4 1 6 0 2 5 7 -1 -1 -1 3 -1 -1 -1 -1, Output - 20 24 21 15 26 16 7 -1 -1 -1 3 -1 -1 -1 -1

Add your answer

Q6. Optimize Memory Usage Problem Statement

Alex wants to maximize the use of 'K' memory spaces on his computer. He has 'N' different document downloads, each with unique memory usage, and 'M' computer games, each ...read more

Ans.

Maximize memory usage by pairing downloads and games within memory limit 'K'.

  • Sort downloads and games in descending order.

  • Iterate through downloads and games to find the pair with maximum memory usage.

  • Return the indices of the selected download and game pairs.

Add your answer
Are these interview questions helpful?

Q7. Spiral Order Traversal of a Binary Tree

Given a binary tree with N nodes, your task is to output the Spiral Order traversal of the binary tree.

Input:

The input consists of a single line containing elements of ...read more
Ans.

Implement a function to output the Spiral Order traversal of a binary tree given in level order.

  • Traverse the binary tree in a spiral order, alternating between left to right and right to left at each level.

  • Use a queue to keep track of nodes at each level and a stack to reverse the order of nodes at odd levels.

  • Handle null nodes appropriately to maintain the spiral order traversal.

  • Example: Input: 1 2 3 -1 -1 4 5, Output: 1 3 2 4 5

Add your answer

Q8. N-th Node From The End Problem Statement

You are provided with a Singly Linked List containing integers. Your task is to determine the N-th node from the end of the list.

Example:

Input:
If the list is (1 -> -2...read more
Ans.

Find the N-th node from the end of a Singly Linked List containing integers.

  • Traverse the list to find the length L of the list.

  • Calculate the position of the N-th node from the beginning as L - N + 1.

  • Traverse the list again to reach the calculated position and return the node's value.

  • Handle edge cases like N being equal to 1 or equal to the length of the list.

Add your answer
Share interview questions and help millions of jobseekers 🌟

Q9. Bottom View of Binary Tree

Given a binary tree, determine and return its bottom view when viewed from left to right. Assume that each child of a node is positioned at a 45-degree angle from its parent.

Nodes in...read more

Ans.

Given a binary tree, return the bottom view of the tree when viewed from left to right.

  • Traverse the tree level by level and keep track of the horizontal distance of each node from the root.

  • For each horizontal distance, store the node with the maximum depth in a map.

  • After traversing the entire tree, return the values of the map in sorted order of their horizontal distance.

Add your answer

Q10. Serialize and Deserialize Binary Tree Problem Statement

Given a binary tree of integers, your task is to implement serialization and deserialization methods. You can choose any algorithm for serialization and d...read more

Ans.

Implement serialization and deserialization methods for a binary tree of integers.

  • Use level order traversal for serialization and deserialization.

  • Use -1 to represent null nodes in the binary tree.

  • Ensure the serialized string can be correctly decoded back to form the original binary tree.

Add your answer

Q11. Number of Islands Problem Statement

You are given a non-empty grid that consists of only 0s and 1s. Your task is to determine the number of islands in this grid.

An island is defined as a group of 1s (represent...read more

Ans.

The task is to determine the number of islands in a grid consisting of 0s and 1s.

  • Iterate through the grid and perform depth-first search (DFS) to find connected 1s.

  • Mark visited 1s as 0 to avoid counting them again.

  • Increment the island count each time a new island is found.

  • Consider all 8 adjacent cells (horizontally, vertically, diagonally) while performing DFS.

  • Handle edge cases like out of bounds and already visited cells.

Add your answer

Q12. Determine the Left View of a Binary Tree

You are given a binary tree of integers. Your task is to determine the left view of the binary tree. The left view consists of nodes that are visible when the tree is vi...read more

Ans.

The task is to determine the left view of a binary tree, which consists of nodes visible when viewed from the left side.

  • Traverse the binary tree in a level order manner and keep track of the leftmost node at each level.

  • Use a queue to perform level order traversal of the binary tree.

  • Maintain a count of nodes at each level to identify the leftmost node.

  • Return the leftmost nodes at each level as the left view of the binary tree.

Add your answer
Q13. Can you explain the concept of virtual destructors in C++?
Ans.

Virtual destructors in C++ are used to ensure that the correct destructor is called when deleting an object through a base class pointer.

  • Virtual destructors are declared with the 'virtual' keyword in the base class to allow proper cleanup of derived class objects.

  • When deleting an object through a base class pointer, having a virtual destructor ensures that the destructor of the derived class is called.

  • Without a virtual destructor, only the base class destructor would be calle...read more

Add your answer

Q14. 1) Maximum meetings in one room 2)Bottom view of tree 3) Serialize deserialize binary tree 4) Difference between Virtual destructor in java and c++

Ans.

Interview questions for Software Developer Intern

  • Maximum meetings in one room can be calculated using greedy approach

  • Bottom view of tree can be obtained using level order traversal and a map to store horizontal distance

  • Serialization and deserialization of binary tree can be done using preorder traversal

  • Virtual destructor in Java is automatically called while in C++ it needs to be explicitly defined

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Software Developer Intern Interview Questions from Similar Companies

3.8
 • 21 Interview Questions
4.2
 • 20 Interview Questions
3.3
 • 18 Interview Questions
4.6
 • 16 Interview Questions
1.9
 • 11 Interview Questions
4.2
 • 11 Interview Questions
View all
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
70 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter