## Find array using different XORs of elements in groups of size 4 in Java

Sunidhi Bansal

Updated on 05-Nov-2021 06:03:24

We are given with an integer array of size N(size of multiple 4) and we have to perform Xclusive OR operation on the array such that input[1- 4] resembles utility_arr[1- 4] and the conditions of computing is If arr[1 – 4] = {a1, a2, a3, a4} then q[1 – 4] ... Read More

## Meet in the middle in Java

Sunidhi Bansal

Updated on 05-Nov-2021 05:34:40

We are provided with an array and a sum value; the problem statement is to calculate the maximum subset sum which does not exceed the given sum value. We cannot apply the brute force approach here because the structure of the given array is not the same as the divide ... Read More

## Maximize the total profit of all the persons X in Java

Sunidhi Bansal

Updated on 05-Nov-2021 05:27:21

We are given 5 Integer variables Num, P1, P2, profit_P1, profit_P2 and the task is to maximize the profit and from all the natural numbers in the range of [1, Num]. The approach here is that if a positive number is divisible by P1 the profit increases by profit_P1 and ... Read More

## Merge K sorted linked lists in Java

Sunidhi Bansal

Updated on 05-Nov-2021 05:20:42

We are given a K number of linked lists of variable sizes which are sorted in their sequence and we have to merge the list into a resultant list in such a way that the resultant array is sorted in order and the resultant array is printed as the output ... Read More

## Minimum number of bombs in Java

Sunidhi Bansal

Updated on 05-Nov-2021 05:12:36

The problem statement here is to kill the goons in the rooms of a building with minimum number of bombings. The rooms are labelled as 1 to n. The goons are injured by the first bombing attack and die in the second. When the rooms are bombed the goons rush ... Read More

## Merge k sorted arrays in Java

Sunidhi Bansal

Updated on 05-Nov-2021 05:07:13

We are given an ‘n’ number of arrays, let's say we take three arrays i.e. arr1[], arr2[] and arr3[] of integer type. The task is to merge all the given integer arrays in such a manner that the resultant array is sorted in the runtime only.Let us understand with exampleInput −Inta[]={21, ... Read More

## Rotate a matrix by 90 degree without using any extra space in C++

Sunidhi Bansal

Updated on 03-Nov-2021 08:41:32

We are given a 2-D array that will be used to form a matrix pattern. The task is to rotate a matrix by 90 degrees in an anti-clockwise direction such that the first row becomes the first column, second row becomes second column and third becomes third column and the ... Read More

## Recursively print all sentences that can be formed from list of word lists in C++

Sunidhi Bansal

Updated on 03-Nov-2021 08:14:36

Given a list of words. The goal is to create all possible sentences that can be formed by taking words from the list using a recursive approach. You can only take one word at a time from both the lists.Let us see various input output scenarios for thisInput −sentence[row][col] = {{"I", ... Read More

## Reverse and Add Function in Java

Sunidhi Bansal

Updated on 03-Nov-2021 08:02:33

We are given with an integer and the agenda here is to reverse the digits of the number and add the reversed number to the original number and check if the resultant number is a palindrome or not and the process is repeated until it does. The breaking point of ... Read More

## Reverse actual bits of the given number in Java

Sunidhi Bansal

Updated on 03-Nov-2021 07:58:16

Given an integer n that is not negative. The goal is to reverse the bits of n and report the number that results from doing so. While reversing the bits, the actual binary form of the integer is used; no leading 0s are taken into account.Let us see various input ... Read More