## Union and Intersection of two Linked Lists

Given two linked lists, create another two linked lists to get union and intersection of the elements of existing lists. Example Input: List1: 5 → 9 → 10 → 12 → 14 List2: 3 → 5 → 9 → 14 → 21 Output: Intersection_list: 14 → 9 → 5 Union_list:   …

## Maximum subsequence sum such that no three are consecutive

The problem “Maximum subsequence sum such that no three are consecutive ” states that you are given an array of integers. Now you need to find a subsequence that has the maximum sum given that you cannot consider three consecutive elements. To recall, a subsequence is nothing but an array …

## Count even length binary sequences with same sum of first and second half bits

The problem “Count even length binary sequences with same sum of first and second half bits” states that you are given an integer. Now find out the number of ways to construct a binary sequence of size 2*n such that the first half and second half have the same number …

## Pair with given product

The problem “Pair with given product” states that you are given an integer array and a number “x”. Determine, whether an array consists of a pair of which product equals ‘x’ exist in the given input array. Example [2,30,12,5] x = 10 Yes, it has Product Pair Explanation Here 2 …

## Queries on XOR of greatest odd divisor of the range

Problem Statement The problem “Queries on XOR of greatest odd divisor of the range” states that you are given an array of integer and query q, each query consists of a range. The problem statement asks to find out the XOR of the greatest odd divisor within the given range …

## Tiling Problem

Problem Statement The “Tiling Problem” states that you have a grid of size 2 x N and a tile of size 2 x 1. So, find the number of ways to tile the given grid. Example 3 2 Explanation: Approach for Tiling Problem We can solve this problem by using recursion. …

## Find all permuted rows of a given row in a matrix

Problem Statement Find all permuted rows of a given row in a matrix states that you are given a matrix of size m*n and a matrix row number says ‘row’. The problem statement asks to find out all the possible rows which are permutation to the given row. This is …

## Largest Sum Contiguous Subarray

Problem Statement You are given an array of integers. The problem statement asks to find out the largest sum contiguous subarray. This means nothing but to find a subarray (continuous elements) which has the largest sum among all other subarrays in the given array. Example arr[] = {1, -3, 4, …

## Heap Sort

Heap sort is a comparison based sorting technique that is based on a Binary Heap data structure. HeapSort is similar to a selection sort where we find the maximum element and then place that element at the end. We repeat this same process for the remaining elements. Given an unsorted …

## Find the Row with Maximum Number of 1’s

Problem Statement In the “Find the Row with Maximum Number of 1’s” problem we have given a matrix(2D array) containing binary digits with each row sorted. Find the row which has the maximum number of 1’s. Input Format The first line containing two integers values n, m. Next, n lines …

Translate »