## Count pair with Given Sum

In problem “count pair with given sum” we have given an integer array[] and another number say ‘sum’, you have to determine whether any of the two elements in a given array has a sum equal to “sum”. Example   Input: arr []={1,3,4,6,7} and sum = 9. Output: “ Elements found …

## Group Multiple Occurrence of Array Elements Ordered by first Occurrence

You are given a question in which you have given an unsorted array with multiple occurrences of numbers. The task is to group all the multiple occurrences of array elements ordered by first occurrence. Meanwhile, the order should be the same as the number comes. Example   Input: [ 2, 3,4,3,1,3,2,4] …

## 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 difference between frequency of two elements such that element having greater frequency is also greater

Suppose, you have an integer array. The problem statement asks to find out the maximum difference between the frequency of any two distinct elements of a given array, but the element with the greater frequency should also be greater in value than the other integer. Example   Input: arr[] = {2,4,4,4,3,2} …

## 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 …

## Segregate 0s and 1s in an Array

Problem Statement   Suppose you have an integer array. The problem “Segregate 0s and 1s in an array” asks to segregate the array in two parts, in 0s and in 1s. The 0’s should be on the left side of the array and 1’s on the right side of the array. …

## Find Largest d in Array such that a + b + c = d

Problem Statement   Suppose you have an array of integers. Input values are all distinct elements. The problem “Find largest d in array such that a + b + c = d” asks to find out the largest element ‘d’ in the set such that a + b + c = …

## Maximum Consecutive Numbers Present in an Array

Problem Statement   Suppose you have an array of integers of size N. The problem “Maximum consecutive numbers present in an array” asks to find out the maximum count of consecutive numbers that could be scattered in an array. Example   arr[] = {2, 24, 30, 26, 99, 25} 3 Explanation: The …

## Total Numbers With no Repeated Digits in a Range

You are given a range of numbers (start, end). The given task says to find out the total numbers of numbers with no repeated digits in a range. Example   Input: 10 50 Output: 37 Explanation: 10 has no repeated digit. 11 has a repeated digit. 12 has no repeated digit. …

## 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 …