Hashmap and Heaps

65 problems to practice.

65 Total
39 Easy
21 Medium
5 Hard

Double Pair Array

1. Given an array of integers A with even length, return true if and only if it is possible to reord...

easy

Subdomain Visit Count

1.A website domain like "mail.google.com" consists of various subdomains. 2.At the top level, we h...

easy

Group Anagrams

1. You are given an array of Strings. 2. You have to write a function that groups all anagrams tog...

easy

Isomorphic Strings

1. You will be given two strings s and t 2. You need to check if they are isomorphic. 3. Two str...

easy

Valid Anagram

1. You are given two Strings S and T of lowercase letters only. 2. You have to find whether T is a...

easy

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...

easy

The Skyline Problem

1. You will be given a matrix with 3 coloumns, containing dimensions of buidings and matrix dimensio...

easy

Word Pattern

1. You will be given a pattern string and a words string 2. You need to check if the words follow...

easy

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...

easy

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...

easy

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...

easy

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...

easy

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...

easy

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...

easy

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...

medium

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...

hard

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...

medium

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...

medium

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....

easy

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...

easy

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...

medium

Equivalent Subarrays

1. You are given an array of integers(arr). 2. You have to find the count of equivalent subarrays....

medium

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...

easy

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...

easy

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...

easy

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...

easy

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...

medium

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...

medium

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...

easy

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...

easy

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...

medium

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...

easy

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...

easy

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...

easy

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...

easy

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...

easy

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,...

easy

Recurring Sequence In A Fraction

1. You are given two numbers which represent the numerator and denominator of a fraction. 2. You ha...

hard

Rabbits In The Forest

1. There are some rabbits in the forest and each rabbit has some color. 2. Some(possibly all) rabbi...

medium

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...

hard

Check Arithmetic Sequence

1. You are given an array(arr) of integers. 2. You have to find if the elements of the given array...

easy

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...

medium

Task Completion

1. You are given two integers N and M, and an array(arr) of numbers with length M. 2. N represents...

easy

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...

easy

Quadruplet Sum

1. You are given an array(arr) of N integers and an integer X. 2. You have to find all unique quadr...

medium

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...

medium

Powerful Number

1. You are given three numbers A, B, and X. 2. You have to print all-powerful numbers that have val...

easy

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...

easy

Lru Cache

Implement LRU(Least Recently Used Cache), Task is to complete implementations of put(),get(). 1. ca...

medium

X Of A Kind In A Deck

https://leetcode.com/problems/x-of-a-kind-in-a-deck-of-cards/

medium

Brick Wall

https://leetcode.com/problems/brick-wall/

medium

Grid Illuminate

https://leetcode.com/problems/grid-illumination/

medium

Max Frequency Stack

Design a stack-like data structure to push elements to the stack and pop the most frequent element f...

easy

Encode And Decode Tinyurl

https://leetcode.com/problems/encode-and-decode-tinyurl/

easy

Insert Delete Getrandom O(1)

https://leetcode.com/problems/insert-delete-getrandom-o1/

medium

Insert Delete Getrandom O(1) - Duplicates Allowed

https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed/

hard

Avoid Flood In The City

<a href="https://leetcode.com/problems/avoid-flood-in-the-city/">https://leetcode.com/problems...

medium

Pairs Of Non Coinciding Points

<a href="https://practice.geeksforgeeks.org/problems/pairs-of-non-coinciding-points4141/1" target...

medium

Line Reflection

Given n points on a 2D plane, find if there is such a line parallel to y-axis that reflect the given...

medium

Random Pick With Blacklist

https://leetcode.com/problems/random-pick-with-blacklist/

hard

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...

medium

A Simple Fraction

<a href="https://practice.geeksforgeeks.org/problems/a-simple-fraction0921/1" target="_blank">...

easy

Minimum Cost To Connect Sticks

You have some number of sticks with positive integer lengths. These lengths are given as an array st...

easy

Rabbits In Forest

<a href="https://leetcode.com/problems/rabbits-in-forest/" target="_blank"><i class="fa fa-...

easy

Tricky Sorting Cost

<a href="https://practice.geeksforgeeks.org/problems/morning-assembly3038/0/" target="_blank">...

easy