Given three integer arrays and a “sum”, the task is to check if there are three elements a, b, c such that a + b + c = sum and a, b and c belong to thre...

Share

Given an array, print all subarrays in the array which has sum 0.
Examples:
Input: arr = [6, 3, -1, -3, 4, -2, 2,
4, 6, -12, -7]
Output:
Subarray foun...

Share

Given an array arr[] of size n containing 0 and 1 only. The problem is to count the subarrays having equal number of 0’s and 1’s.
Examples:
Input : arr[...

Share

Given an array, the task is to calculate the sum of lengths of contiguous subarrays having all elements distinct.
Examples:
Input : arr[] = {1, 2, 3}
Output : 10
{1,...

Share

Given an array of n integers. Count total number of sub-array having total distinct elements same as that of total distinct elements of original array.
Examples:
Inp...

Share

Given two same sized arrays A[] and B[] (both arrays contain distinct elements individually but may have some common elements), task is to form a third (or result) ar...

Share

Given an array of N integers, count number of even-odd subarrays. An even – odd subarray is a subarray that contains the same number of even as well as odd int...

Share

Given k sorted arrays of size n each, merge them and print the sorted output.
Example:
Input:
k = 3, n = 4
arr[][] = { {1, 3, 5, 7},
{2, 4, 6, 8},
...

Share

Given two equally sized arrays (A, B) and N (size of both arrays).
A sum combination is made by adding one element from array A and another element of array B. Displa...

Share

Why is Quick Sort preferred for arrays?
Below are recursive and iterative implementations of Quick Sort and Merge Sort for arrays.
Recursive Quick Sort for array.
Ite...

Share