## Case-specific sorting of Strings in O(n) time and O(1) space

Given a string str consisting of uppercase and lowercase characters. The task is to sort uppercase and lowercase characters separately such that if the ith… Read More »

- Count common characters in two strings
- Find minimum difference between any two elements | Set 2
- Find two numbers whose divisors are given in a random order
- Count occurrences of a string that can be constructed from another given string
- Find the minimum number of operations required to make all array elements equal
- Find the smallest positive number missing from an unsorted array : Hashing Implementation
- Minimum sum of two numbers formed from digits of an array in O(n)
- Remove all occurrences of any element for maximum array sum
- Make palindromic string non-palindromic by rearranging its letters
- Minimize the number of replacements to get a string with same number of 'a', 'b' and 'c' in it
- Queries to find the first non-repeating character in the sub-string of a string
- Count of quadruplets from range [L, R] having GCD equal to K
- Design a stack which can give maximum frequency element
- Count all elements in the array which appears at least K times after their first occurrence
- Minimum deletions required such that any number X will occur exactly X times
- Count the number of pairs (i, j) such that either arr[i] is divisible by arr[j] or arr[j] is divisible by arr[i]
- Maximum product from array such that frequency sum of all repeating elements in product is less than or equal to 2 * k
- Find the last non repeating character in string
- Queries to find the last non-repeating character in the sub-string of a given string
- Sum of all odd frequency nodes of the Linked List
- Count pairs with set bits sum equal to K
- Minimum number of given operations required to reduce the array to 0 element
- Print characters having odd frequencies in order of occurrence
- Maximum count of pairs which generate the same sum
- Number of ways in which the substring in range [L, R] can be formed using characters out of the range
- Character whose frequency is equal to the sum of frequencies of other characters of the given string
- Number of quadruples where the first three terms are in AP and last three terms are in GP
- Maximum points covered after removing an Interval
- Length of the largest substring which have character with frequency greater than or equal to half of the substring
- Largest even number that can be formed by any number of swaps

Given a string str consisting of uppercase and lowercase characters. The task is to sort uppercase and lowercase characters separately such that if the ith… Read More »

Given two strings str1 and str2 of lengths M and N respectively. The task is to find all the distinct string of length M +… Read More »

Given a string of lowercase English alphabets and an integer 0 < K <= 26. The task is to divide the string into two parts… Read More »

Given a linked list. Find the first element from the left which appears more than once. If all the elements are unique then print -1.… Read More »

Given two integers N and K. Find the numbers of triplets (a, b, c) such that 0 ≤ a, b, c ≤ N and (a… Read More »

Given an array arr[] of N integers, the task is to find the minimum deletions required such that frequency of arr[i] is exactly arr[i] in… Read More »

Given an array of size N. The task to find the maximum possible number of elements divisible by 3 that are in the array after… Read More »

Given N elements and the task is to implement a stack which removes and returns the maximum frequency element on every pop operation. If there’s… Read More »

Given an array arr[] and an integer K, the task is to count the pairs whose sum of set bits is K Examples: Input: arr[]… Read More »

Given an unsorted array arr[] of size n, the task is to find the minimum difference between any pair in the given array. Input: arr[]… Read More »

Given a string str and an integer K, the task is to find the length of the longest sub-string S’ such that every character in… Read More »

Given a string str, the task is to answer Q queries where every query consists of two integers L and R and we have to… Read More »

Given a string, find a prefix with the highest frequency. If two prefixes have the same frequency then consider the one with maximum length. Examples:… Read More »

Given an array arr[] of N integers where all elements of the array are from the range [0, 9] i.e. a single digit, the task… Read More »

Given a string S consisting of character from ‘a’ to ‘z’. The task is to find the length of the largest substring of S which… Read More »