Given an integer array arr[] and a positive integer K, the task is to count all distinct pairs with differences equal to K. Examples: Input:… Read More

# Category Archives: Hash

Given an array arr[] of size N and an integer K, the task is to minimize the value of the maximum element of the array… Read More

Given an array arr[] of size N, the task is to check if the array elements can be rearranged in a way such that the… Read More

Given an array arr[] of size N and an integer K, denoting the maximum value an array element can have, the task is to check… Read More

Given a singly linked list, the task is to Count the pairs of nodes with greater Bitwise AND than Bitwise XOR. Examples: Input: list: 1->4->2->6->3Output:… Read More

Given an array A[] having N positive integers, the task is to perform the following operations and maximize the sum obtained while reducing the array:… Read More

Given an array arr[] of length N, the task is to find the minimum number of operations to change the array such that each arr[i]… Read More

Given an array nums[], and integer K and X, the task is to find the most frequent element K positions away from X in the… Read More

Given an array arr[] of length N the task is to find the minimum number of elements to be added in the array such that… Read More

Given an array arr[] containing positive integers, count the total number of pairs for which arr[i]+i = arr[j]+j such that 0≤i<j≤n-1. Examples: Input: arr[] =… Read More

Given an array arr[] of size N, and Q queries of the form [A, B], the task is to find all the unique elements from… Read More

Given an array of strings arr[] of size N. Each of the strings contains lowercase English letters or numbers only. The task is to find… Read More

Given an array arr[] of size N, the task is to find the number of pairs of the array upon removing which the mean (i.e.… Read More