## Count all distinct pairs with difference equal to k

Given an integer array and a positive integer k, count all distinct pairs with difference equal to k. Examples: Input: arr[] = {1, 5, 3,… Read More »

- Find the longest string that can be made up of other strings from the array
- Minimum length substring with exactly K distinct characters
- Rearrange characters in a string such that no two adjacent are same using hashing
- Flip minimum signs of array elements to get minimum sum of positive elements possible
- Sum of nodes in bottom view of Binary Tree
- Count duplicates in a given linked list
- Sum of nodes in top view of binary tree
- Split the array elements into strictly increasing and decreasing sequence
- Find uncommon characters of the two strings | Set 2
- Design a stack which can give maximum frequency element
- Count equal pairs from given string arrays
- Minimum number of given operations required to convert a permutation into an identity permutation
- Remove all occurrences of any element for maximum array sum
- Count of pairs of strings which differ in exactly one position
- Minimum Bitwise XOR operations to make any two array elements equal
- Longest subsequence such that every element in the subsequence is formed by multiplying previous element with a prime
- Two equal sum segment range queries
- Count of pairs between two arrays such that the sums are distinct
- Count all elements in the array which appears at least K times after their first occurrence
- Minimum changes required to make a Catalan Sequence
- Partiton the string in two parts such that both parts have at least k different characters
- Minimum number of given operations required to reduce the array to 0 element
- Find the lexicographically smallest sequence which can be formed by re-arranging elements of second array
- Find d to maximize the number of zeros in array c[] created as c[i] = d*a[i] + b[i]
- Maximum length of a sub-array with ugly numbers
- Print characters having odd frequencies in order of occurrence
- Count number of pairs in array having sum divisible by K | SET 2
- Rearrange given string to maximize the occurrence of string t
- Number of Positions to partition the string such that atleast m characters with same frequency are present in each substring
- Number of ways in which the substring in range [L, R] can be formed using characters out of the range

Given an integer array and a positive integer k, count all distinct pairs with difference equal to k. Examples: Input: arr[] = {1, 5, 3,… Read More »

Given a stream of characters, find the first non-repeating character from stream. You need to tell the first non-repeating character in O(1) time at any… Read More »

Given an array of words, print all anagrams together. For example, if the given array is {“cat”, “dog”, “tac”, “god”, “act”}, then output may be… Read More »

Given an array of integers, find any one combination of four elements in the array whose sum is equal to a given value X. For… Read More »

Given an array containing only 0s and 1s, find the largest subarray which contain equal no of 0s and 1s. Expected time complexity is O(n).… Read More »

Given two Linked Lists, create union and intersection lists that contain union and intersection of the elements present in the given lists. Order of elments… Read More »

Given a Binary Tree, find the vertical sum of the nodes that are in the same vertical line. Print all sums through different vertical lines.… Read More »

Given two arrays: arr1[0..m-1] and arr2[0..n-1]. Find whether arr2[] is a subset of arr1[] or not. Both the arrays are not in sorted order. It… Read More »

Given two strings string1 and string2, the task is to find the smallest substring in string1 containing all characters of string2 efficiently. Examples: Input: string… Read More »

Given an array of positive integers. All numbers occur even number of times except one number which occurs odd number of times. Find the number… Read More »

Write a program that, given an array A[] of n numbers and another number x, determines whether or not there exist two elements in S… Read More »

Write an efficient function to return maximum occurring character in the input string e.g., if input string is “test” then function should return ‘t’. Recommended:… Read More »