Skip to content

Category Archives: Hash

  Suppose we want to design a system for storing employee records with phone numbers(as keys). And we want the following queries to be performed… Read More
Given a binary tree, print it vertically. The following example illustrates the vertical order traversal. 1 / \ 2 3 / \ / \ 4… Read More
Given an array of positive and negative numbers, find if there is a subarray (of size at least one) with 0 sum. Examples:  Click here… Read More
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.Examples:  … 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 an even number of times except one number which occurs an odd number of times. Find… 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

Start Your Coding Journey Now!