## All Unique Triplets that Sum up to a Given Value

We have given an array of integers and a given number called ‘sum’. The problem statement asks to find out the triplet that adds up to the given number ‘sum’. Example Input: arr[] = {3,5,7,5,6,1} sum=16 Output: (3, 7, 6), (5, 5, 6) Explanation: Triplet which equals to the given …

## Find whether an array is subset of another array

The problem “Find whether an array is subset of another array” states that you are given two arrays arra1[] and array2[]. The arrays given are in an unsorted manner. Your task is to find whether the array2[] is a subset of array1[]. Example arr1= [1,4,5,7,8,2] arr2= [1,7,2,4] arr2 [] is …

## Count of index pairs with equal elements in an array

Suppose, we have given an integer array. The problem “Count of index pairs with equal elements in an array” asks to find out the no of pair of indices (i,j) in such a way that arr[i]=arr[j] and i is not equal to j. Example arr[] = {2,3,1,2,3,1,4} 3 Explanation Pairs …

## Print all triplets in sorted array that form AP

The problem “Print all triplets in sorted array that form AP” states that we have given a sorted integer array. The task is to find out all the possible triplets that can form an Arithmetic Progression. Example arr[] = {1,3,5,7,8,12,15,16,20,30} (1, 3, 5), (3, 5, 7), (1, 8, 15), (8, …

## Find number of pairs in an array such that their XOR is 0

The problem “Find number of pairs in an array such that their XOR is 0” state that supposes, we have given an array of integers. The problem statement asks to find out the number of pairs present in an array, which has the pair Ai XOR Aj = 0. Note: …

## Find all triplets with zero sum

The problem “Find all triplets with zero sum” states that you are given an array containing positive and negative number both. The problem statement asks to find out the triplet with the sum equal to 0. Example arr[] = {0,-2,1,3,2,-1} (-2 -1  3) (-2 0  2) (-1 0  1) Explanation …

## k-th missing element in increasing sequence which is not present in a given sequence

The problem “k-th missing element in increasing sequence which is not present in a given sequence” states that you are given two arrays. One of them is arranged in ascending order and another normal unsorted array with number k. Find the kth missing element which is not present in normal …

## How to check if two given sets are disjoint?

The problem “How to check if two given sets are disjoint?” states that suppose you are given two sets in the form of array say set1[] and set2[]. Your task is to find out whether the two sets are Disjoint Sets or not. Example inputSet1[] = {1, 15, 8, 9, …

## Sort an array according to the order defined by another array

Problem Statement You are given two arrays of integers arr1[] and arr2[]. The problem “Sort an array according to the order defined by another array” asks to sort the first array according to the second array so that the numbers in first array will be relatively sorted off all the …

## Number of siblings of a given Node in n-ary Tree

Problem Statement The problem “Number of siblings of a given Node in n-ary Tree” states that you are given an n-ary Tree and a target node. Find the number of siblings of the target node. Assume that node is always present in the tree and the first node is the …

Translate »