Hashmap and Heaps
65 problems to practice.
Double Pair Array
1. Given an array of integers A with even length, return true if and only if it is possible to reord...
Subdomain Visit Count
1.A website domain like "mail.google.com" consists of various subdomains. 2.At the top level, we h...
Group Anagrams
1. You are given an array of Strings. 2. You have to write a function that groups all anagrams tog...
Isomorphic Strings
1. You will be given two strings s and t 2. You need to check if they are isomorphic. 3. Two str...
Valid Anagram
1. You are given two Strings S and T of lowercase letters only. 2. You have to find whether T is a...
Longest Subarray With Sum Divisible By K
1.Given an array containing N integers and a positive integer K. 2.The task is to find the length...
The Skyline Problem
1. You will be given a matrix with 3 coloumns, containing dimensions of buidings and matrix dimensio...
Word Pattern
1. You will be given a pattern string and a words string 2. You need to check if the words follow...
Number Of Employees Under Every Manager
1. You are given number N and 2*N number of strings that contains mapping of the employee and his ma...
Find Itinerary From Tickets
1. You are given number N and 2*N number of strings that represent a list of N tickets(source and de...
Check If An Array Can Be Divided Into Pairs Whose Sum Is Divisible By K
1. You are given an array(arr) of integers and a number K. 2. You have to find if the given array c...
Largest Subarray With Zero Sum
1. You are given an array(arr) of integers. 2. You have to find the length of the largest subarray...
Count Distinct Elements In Every Window Of Size K
1. You are given an array(arr) of integers and a number K. 2. You have to find the count of distinc...
Largest Subarray With Contiguous Elements
1. You are given an array(arr) of integers. Values may be duplicated. 2. You have to find the lengt...
Count Of All Subarrays With Zero Sum
1. You are given an array(arr) of integers. 2. You have to find the count of all subarrays with sum...
Smallest Substring Of A String Containing All Characters Of Another String
1. You are given two strings s1 and s2 containing lowercase english alphabets. 2. You have to find...
Smallest Substring Of A String Containing All Unique Characters Of Itself
1. You are given a string str. 2. You have to find the smallest window length that contains all the...
Longest Substring With Non Repeating Characters
1. You are given a string. 2. You have to find the length of the longest substring of the given str...
Count Of Substrings Having All Unique Characters
1. You are given a string. 2. You have to find the count of valid substrings of the given string....
Longest Substring With Exactly K Unique Characters
1. You are given a string(str) and a number K. 2. You have to find length of the longest substring...
Count Of Substrings With Exactly K Unique Characters
1. You are given a string(str) and a number K. 2. You have to find the count of valid substrings of...
Equivalent Subarrays
1. You are given an array of integers(arr). 2. You have to find the count of equivalent subarrays....
Maximum Consecutive Ones - 1
1. You are given an array(arr) which contains only 0's and 1's. 2. You have to find the maximum num...
Maximum Consecutive Ones - 2
1. You are given an array(arr) which contains only 0's and 1's and a number K. 2. You have to find...
Longest Substring With At Most K Unique Characters
1. You are given a string(str) and a number K. 2. You have to find the length of longest substring...
Count Of Substrings Having At Most K Unique Characters
1. You are given a string(str) and a number K. 2. You have to find the count of substrings of the g...
Count Of Subarrays Having Sum Equals To K
1. You are given an array of integers(arr) and a number K. 2. You have to find the count of subarra...
Find All Anagrams In A String
1. You are given two strings s1 and s2. 2. You have to find the count of s2's anagrams that are pre...
K Anagrams
1. You are given two strings s1, s2, and a number K. 2. You have to find if two strings are K-anagr...
Find Anagram Mappings
1. You are given two integer arrays(A and B), where B is an anagram of A. 2. B is an anagram of A m...
Group Shifted String
1. You are given an array of strings. 2. You have to group the given strings in such a way that all...
Count Of Subarrays With Sum Divisible By K
1. You are given an array of integers(arr) and a number K. 2. You have to find the count of subarra...
Longest Subarray With Equal Number Of Zeroes And Ones
1. You are given an array that contains only 0s and 1s. 2. You have to find length of the longest s...
Count Of Subarrays With Equal Number Of Zeroes And Ones
1. You are given an array that contains only 0s and 1s. 2. You have to find the count of subarrays...
Longest Subarray With Equal Number Of 0s 1s And 2s
1. You are given an array that contains only 0s, 1s, and 2s. 2. You have to find length of the long...
Count Of Subarrays With Equal Number Of 0s 1s And 2s
1. You are given an array that contains only 0s, 1s, and 2s. 2. You have to find the count of subar...
Pairs With Equal Sum
1. You are given an array(arr) of distinct integers. 2. You have to find if there are two pairs(A,...
Recurring Sequence In A Fraction
1. You are given two numbers which represent the numerator and denominator of a fraction. 2. You ha...
Rabbits In The Forest
1. There are some rabbits in the forest and each rabbit has some color. 2. Some(possibly all) rabbi...
Maximum Points On A Line
1. You are given a 2-D array of integers where every row represents x and y co-ordinate of a point o...
Check Arithmetic Sequence
1. You are given an array(arr) of integers. 2. You have to find if the elements of the given array...
Smallest Subarray With All Occurrences Of The Most Frequent Element
1. You are given an array(arr) of integers. 2. You have to find the element(x) with maximum frequen...
Task Completion
1. You are given two integers N and M, and an array(arr) of numbers with length M. 2. N represents...
Pairs With Given Sum In Two Sorted Matrices
1. You are given a number N and two sorted matrices(A and B) of N*N dimensions. 2. You are also giv...
Quadruplet Sum
1. You are given an array(arr) of N integers and an integer X. 2. You have to find all unique quadr...
Quadruplet Sum - 2
1. You are given four arrays(A1,A2,A3,A4) of integers. All arrays are of same length(N). 2. You hav...
Powerful Number
1. You are given three numbers A, B, and X. 2. You have to print all-powerful numbers that have val...
First Non-repeating Character
1. You are given a string. 2. You have to find the index of the first non-repeating character in th...
Lru Cache
Implement LRU(Least Recently Used Cache), Task is to complete implementations of put(),get(). 1. ca...
X Of A Kind In A Deck
https://leetcode.com/problems/x-of-a-kind-in-a-deck-of-cards/
Brick Wall
https://leetcode.com/problems/brick-wall/
Grid Illuminate
https://leetcode.com/problems/grid-illumination/
Max Frequency Stack
Design a stack-like data structure to push elements to the stack and pop the most frequent element f...
Encode And Decode Tinyurl
https://leetcode.com/problems/encode-and-decode-tinyurl/
Insert Delete Getrandom O(1)
https://leetcode.com/problems/insert-delete-getrandom-o1/
Insert Delete Getrandom O(1) - Duplicates Allowed
https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed/
Avoid Flood In The City
<a href="https://leetcode.com/problems/avoid-flood-in-the-city/">https://leetcode.com/problems...
Pairs Of Non Coinciding Points
<a href="https://practice.geeksforgeeks.org/problems/pairs-of-non-coinciding-points4141/1" target...
Line Reflection
Given n points on a 2D plane, find if there is such a line parallel to y-axis that reflect the given...
Random Pick With Blacklist
https://leetcode.com/problems/random-pick-with-blacklist/
Longest Substring With At Most Two Distinct Characters
Given a string s, return the length of the longest substring that contains at most two distinct char...
A Simple Fraction
<a href="https://practice.geeksforgeeks.org/problems/a-simple-fraction0921/1" target="_blank">...
Minimum Cost To Connect Sticks
You have some number of sticks with positive integer lengths. These lengths are given as an array st...
Rabbits In Forest
<a href="https://leetcode.com/problems/rabbits-in-forest/" target="_blank"><i class="fa fa-...
Tricky Sorting Cost
<a href="https://practice.geeksforgeeks.org/problems/morning-assembly3038/0/" target="_blank">...