Skip to content

Category Archives: Hash

Given an integer array and a positive integer k, count all distinct pairs with differences equal to k.  Examples:  Input: arr[] = {1, 5, 3,… Read More
Given a stream of characters, find the first non-repeating character from the stream. You need to tell the first non-repeating character in O(1) time at… 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 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 anyone combination of four elements in the array whose sum is equal to a given value X. For example, … Read More
Given an array containing only 0s and 1s, find the largest subarray which contains equal no of 0s and 1s. The expected time complexity is… Read More
Given two Linked Lists, create union and intersection lists that contain union and intersection of the elements present in the given lists. The order of… 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 arrays are not in sorted order. It may… Read More
Given two strings, string and pattern, the task is to find the smallest substring in string containing all characters of pattern.  Examples:  Input: string =… Read More
Given an array arr[] consisting of positive integers that occur even number of times, except one number, which occurs odd number of times. The task… Read More
Given an array of positive integers. All numbers occur an even number of times except one number which occurs an odd number of times. Find… Read More
Given an array A[] of n numbers and another number x, the task is to check whether or not there exist two elements in A[]… Read More
Given string str. The task is to find the maximum occurring character in the string str. Examples: Input: geeksforgeeksOutput: eExplanation: ‘e’ occurs 4 times in the… Read More

Start Your Coding Journey Now!