## Longest subarray with difference exactly K between any two distinct values

Given an array arr[] of length N and an integer K, the task is to find the longest subarray with difference between any two distict… Read More »

- Set of Vectors in C++ STL with Examples
- How to convert a Vector to Set in C++
- Implementing upper_bound() and lower_bound() for Ordered Set in C++
- Implementation of lower_bound and upper_bound on Set of Pairs in C++
- Longest subarray with difference exactly K between any two distinct values
- Maximize count of distinct elements possible in an Array from the given operation
- Largest subset with M as smallest missing number
- Smallest number to be added in first Array modulo M to make frequencies of both Arrays equal
- Most frequent element in Array after replacing given index by K for Q queries
- Check if K distinct array elements form an odd sum
- Count of prime factors of N to be added at each step to convert N to M

Given an array arr[] of length N and an integer K, the task is to find the longest subarray with difference between any two distict… Read More »

Given an array arr[] of N positive integers and a positive integer M, the task is to find the length of longest subset whose smallest… Read More »

Given an array A[] of size N, the task is to maximize the count of distinct elements in the array by inserting the absolute differences… Read More »

Given two arrays A[] and B[] consisting of N positive integers and a integer M, the task is to find the minimum value of X… Read More »

Given two integers N and M, the task is to find out minimum number of operations required to convert N to M. Each operation involves… Read More »

Given an array arr[] of size N, and Q queries of the form {i, k} for which, the task is to print the most frequent… Read More »

Given an array of N elements, the task is to find the minimum value of K such that Bitwise XOR of K with all array… Read More »

Given a matrix A[][] of dimensions N*M, the task is to find the minimum number of moves required to traverse the entire matrix starting from… Read More »

Given a Set of integers sett and an integer index, the task is to find the element in the set which is present at index.… Read More »

Given an array A[] of size N, the task is to check if it is possible to get odd sum using K distinct elements from… Read More »

Prerequisite: set lower_bound() function in C++ STL, set upper_bound() function in C++ STL lower_bound() returns an iterator pointing to the first element in the range… Read More »

This article shows how to convert a vector to a set in C++. Example: Input: vector = {1, 2, 3, 1, 1} Output: set =… Read More »

Prerequisites: Ordered Set and GNU C++ PBDS Given an ordered set set and a key K, the task is to find the upper bound and… Read More »

Set in STL Sets are a type of associative containers in which each element has to be unique, because the value of the element identifies… Read More »

Given an unsorted array with both positive and negative elements. The task is to find the smallest positive number missing from the array. Examples: Input:… Read More »