## Subarray whose sum is closest to K

Given an array of positive and negative integers and an integer K. The task is to find the subarray which has its sum closest to… Read More »

- Find the smallest positive number missing from an unsorted array | Set 3
- Print combinations of distinct numbers which add up to give sum N
- Find the lexicographically smallest sequence which can be formed by re-arranging elements of second array
- Distinct pairs from given arrays (a[i], b[j]) such that (a[i] + b[j]) is a Fibonacci number
- Total distinct pairs from two arrays such that second number can be obtained by inverting bits of first
- Greatest number less than equal to B that can be formed from the digits of A
- Distinct state codes that appear in a string as contiguous sub-strings
- Find the Jaccard Index and Jaccard Distance between the two given sets

Given an array of positive and negative integers and an integer K. The task is to find the subarray which has its sum closest to… Read More »

Given an array of distinct elements, print the closest greater element for every element. The closest greater element for an element x is the smallest… Read More »

Given Q queries of type 1, 2, 3 and 4 as described below. Type-1: Insert a number to the list. Type-2: Delete only one occurrence… Read More »

The set::cbegin() is a built-in function in C++ STL which returns a constant iterator pointing to the first element in the container. The iterator cannot… Read More »

The set::crbegin() is a built-in function in C++ STL which returns a constant iterator pointing to the last element in the container. The iterator cannot… Read More »

The set::count() is a built-in function in C++ STL which returns the number of times an element occurs in the set. It can only return… Read More »

The set::max_size() is a built-in function in C++ STL which returns the maximum number of elements a set container can hold. Syntax: set_name.max_size() Parameters: This… Read More »

The set::emplace_hint() is a built-in function in C++ STL which inserts a new element in the set. A position is passed in the parameter of… Read More »

The set::upper_bound() is a built-in function in C++ STL which returns an iterator pointing to the immediate next element which is just greater than k.… Read More »

The set::lower_bound() is a built-in function in C++ STL which returns an iterator pointing to the element in the container which is equivalent to k… Read More »

The set::find is a built-in function in C++ STL which returns an iterator to the element which is searched in the set container. If the… Read More »

The set::insert is a built-in function in C++ STL which insert elements in the set container or inserts the elements from a position to another… Read More »

The set::equal_range() is a built-in function in C++ STL which returns an iterator of pairs. The pair refers to the range that includes all the… Read More »

Given a string and an integer M, print all distinct circular strings of length M in lexicographical order. Examples: Input: str = “baaaa”, M =… Read More »

Given an array of N elements and an integer K, print all the distinct integers which can be formed by choosing K numbers from the… Read More »