Categories of Questions

## Array Questions BlackRock

**Question 1. Minimum sum of multiplications of n numbers** The problem “Minimum sum of multiplications of n numbers” states that you are given n integers and you need to minimize the sum of multiplication of all the numbers by taking two elements that are adjacent at a time and putting back their sum mod 100 until a single number ...

**Question 2. Minimum operation to make all elements equal in array** The problem “Minimum operation to make all elements equal in array” states that you are given an array with some integers in it. You have to find out the minimum operations that can be done to make an array equal. Example [ 1,3,2,4,1] 3 Explanation Either 3 subtractions can be ...

**Question 3. Find whether a subarray is in form of a mountain or not** Problem Statement The problem “Find whether a subarray is in form of a mountain or not” states that you are given an integer array and a range. The problem statement asks to find out whether the sub-array formed between the given range is in form of a mountain form or ...

**Question 4. Range sum queries without updates** Problem Statement The problem “Range sum queries without updates” states that you have an array of integers and a range. The problem statement asks to find out the sum of all the elements within the given range. Example arr[]={10, 9, 8, 7, 6} Query: {(0, 4), (1, 3)} 40 24 ...

**Question 5. Three way partitioning of an array around a given range** Problem Statement You are given an array of integers and a range of lowValue and highValue. The problem “Three way partitioning of an array around a given range” asks to partition the array such that array will be divided into three parts. The partitions of the arrays will be: Elements ...

**Question 6. Minimum number of distinct elements after removing m items** Problem Statement The problem “Minimum number of distinct elements after removing m items” states that you have an array and an integer m. Each element of the array indicates an item id’s. The problem statement asks to remove m elements in such a way that there should be a minimum ...

**Question 7. Count Pairs Whose Products Exist in Array** In count pairs whose products exist in array problem we have given an array, count all the distinct pairs whose product value is present in the array. Example Input A[]={2, 5, 6, 3, 15} Output Number of distinct pairs whose product exists in the array is: 2 Pairs are: (2, ...

**Question 8. Coin Change Problem** Coin Change Problem – Given some coins of different values c1, c2, … , cs (For instance: 1,4,7….). We need an amount n. Use these given coins to form the amount n. You can use a coin as many times as required. Find the total number of ways in which ...

**Question 9. A Product Array Puzzle** Problem Statement In a product array puzzle problem we need to construct an array where the ith element will be the product of all the elements in the given array except element at the ith position. Example Input 5 10 3 5 6 2 Output 180 600 360 300 900 ...

## String Questions BlackRock

**Question 10. Integer to Roman Leetcode Solution** In this problem, we are given an integer and are required to convert into roman numeral. Thus the problem is generally referred to as “Integer to Roman” and this is Integer to Roman Leetcode Solution. If someone does not know about Roman numerals. In the old times, people did not ...

**Question 11. Maximum weight transformation of a given string** Problem Statement The maximum weight transformation of a given string problem states that given a string consisting only of two characters ‘A’ and ‘B’. We have an operation where we can transform string to another string by toggling any character. Thus many transformations are possible. Out of all the possible ...

**Question 12. Group Words With Same Set of Characters** In Group words with same set of characters problem, we have given a list of words with lower cases. Implement a function to find all Words that have the same unique character set. Example Input Words[]={ “may”, “student”, “students”, “dog”,”studentssess”, “god”, “cat”, “act”,”tab”, “bat”, “flow”, “wolf”, “lambs”,”amy”, “yam”, “balms”, “looped”, ...

## Tree Questions BlackRock

**Question 13. Minimum number of distinct elements after removing m items** Problem Statement The problem “Minimum number of distinct elements after removing m items” states that you have an array and an integer m. Each element of the array indicates an item id’s. The problem statement asks to remove m elements in such a way that there should be a minimum ...

**Question 14. Convert BST to Min Heap** Problem Statement Given a complete Binary Search Tree, write an algorithm to convert it into a Min Heap, which is to convert BST to Min Heap. The Min Heap should be such that the values on the left of a node must be less than the values on the right ...

## Stack Questions BlackRock

**Question 15. Reversing the First K elements of a Queue** In reversing the first K elements of a queue problem we have given a queue and a number k, reverse the first k elements of a queue using standard operations of the queue. Examples Input: queue = 10 -> 15 -> 31 -> 17 -> 12 -> 19 -> 2 ...

## Queue Questions BlackRock

**Question 16. Reversing the First K elements of a Queue** In reversing the first K elements of a queue problem we have given a queue and a number k, reverse the first k elements of a queue using standard operations of the queue. Examples Input: queue = 10 -> 15 -> 31 -> 17 -> 12 -> 19 -> 2 ...

## Matrix Questions BlackRock

**Question 17. Find distinct elements common to all rows of a matrix** Problem Statement We are given a matrix of all the integers. The problem “Find distinct elements common to all rows of a matrix” asks to find out all the possible distinct elements but common in each of the rows present in a matrix. Example arr[]={ {11, 12, 3, 10}, {11, ...

## Other Questions BlackRock

**Question 18. Maximum number of segments of lengths a, b and c** The problem “Maximum number of segments of lengths a, b and c” states that you are given a positive integer N, and you need to find the maximum number of segments of lengths a,b, and c that can be formed using N. Example N = 7 a = 5, b ...

**Question 19. A Space Optimized DP solution for 0-1 Knapsack Problem** Problem Statement We are given a knapsack which can hold some weight, we need to pick some of the items out of given items with some value. The items should be picked such that the value of the knapsack ( total value of picked up items ) should be maximized. ...

**Question 20. Swap Kth Node from beginning with Kth Node from End** Problem Statement In the “Swap Kth Node from beginning with Kth Node from End” problem, we have given a linked list. Swap kth node from beginning_with kth node from the end. We should not swap the values, we should swap pointers. Example 2 1 2 3 4 5 6 1 ...