0% found this document useful (0 votes)
2K views30 pages

Striver's Competitive Programming Guide

The CP list primarily focuses on algorithmic problems needed for coding interviews and competitions. The problems were selected to teach specific algorithms like linear search, hashing, prefix sum, sliding window, binary search, and more. Solving around 50 problems is recommended to learn the core concepts. In addition to the CP list, practicing on coding sites and doing the SDE sheet is advised.

Uploaded by

Harsh Agrawal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views30 pages

Striver's Competitive Programming Guide

The CP list primarily focuses on algorithmic problems needed for coding interviews and competitions. The problems were selected to teach specific algorithms like linear search, hashing, prefix sum, sliding window, binary search, and more. Solving around 50 problems is recommended to learn the core concepts. In addition to the CP list, practicing on coding sites and doing the SDE sheet is advised.

Uploaded by

Harsh Agrawal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

Striver’s CP List(Solely for preparing for Coding Rounds of Top

Prod Based Companies and to do well in Coding Sites and


Competitions)

SDE SHEET​: ​https://bit.ly/takeUforward_SDE


SUCCESS stories of SDE sheet at Insta profile: striver_79

All the following questions have been answered in this video ->
https://youtu.be/QtTPohzfxA8

1. What does the CP list primarily focus on ?


2. How have the problems been selected ?
3. How many problems do you need to do in order to get concepts required for coding
rounds ?
4. What apart from the CP list do we need to do?

Pre-requisites: Point 1 and Point 2

1. Before starting off CP, make sure you know one language, which means you how to
take an input, print something, run for loops, snd STL/Collection for the language you
are using, these things are more than enough to start, just don’t think you need
everything in place to start, so just start.
2. At first make sure your constructive algorithms are good, which means you can solve
simple story line problems. For that my suggestion will be to do A2OJ
ladder(alternative: ​https://a2oj.herokuapp.com/​), 50 A problems and 50 B level
problems to start off with.
3. Next I will be giving you the algorithms name you need to know and 5-10 problems
on each of them. These problems will help you to understand the concept of the
algorithm, and will help you to understand how we can tweak the algorithms to solve
given problems. Even after this you don’t feel comfortable with the Algorithm, my
suggestion will be to google some more problems and solve. To reach an expert
level at Codeforces, you just need to solve A, B and C problems at quick succession
and on a constant basis. There are very few chances that you will be encountering
an algorithmic problem on Codeforces unless and until its the D level problem or
beyond. So you need to do as many algorithmic problems as you can, which will help
you during your coding rounds.

Note​: The Algorithmic Problems might require a mixture of Algorithms in order to be


solved, so be careful while you think, just don’t think on a particular algo only.

Disclaimer​: If you feel it's getting tough, I will suggest to do SDE sheet as well as
you can, and take the concepts as properly as you can!!

Linear Search:
1. https://www.hackerearth.com/practice/algorithms/searching/linear-search/prac
tice-problems/algorithm/simple-search-4/
2. https://www.hackerearth.com/practice/algorithms/searching/linear-search/prac
tice-problems/algorithm/maximum-sum-4-f8d12458/
3. https://www.hackerearth.com/practice/algorithms/searching/linear-search/prac
tice-problems/algorithm/mannas-first-name-4/
4. https://www.codechef.com/problems/SEGM01
5. https://www.hackerearth.com/practice/algorithms/searching/linear-search/prac
tice-problems/algorithm/rest-in-peace-21-1/

Hashing​: (Basic and not String Hashing)


1. https://www.hackerearth.com/practice/data-structures/hash-tables/basics-of-h
ash-tables/practice-problems/algorithm/maximum-occurrence-9/
2. https://codeforces.com/problemset/problem/4/C
3. https://www.hackerearth.com/practice/data-structures/hash-tables/basics-of-h
ash-tables/practice-problems/algorithm/perfect-pair-df920e90/description/
4. https://codeforces.com/problemset/problem/486/B

PrefixSum:
1. https://www.spoj.com/problems/CSUMQ/
2. https://www.codechef.com/problems/BLONDIE
3. https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&categor
y=24&page=show_problem&problem=1474
4. https://www.hackerrank.com/contests/ab-yeh-kar-ke-dikhao/challenges/kj-and
-street-lights/leaderboard​ (learn the scanline algo trick, probably from here
https://www.youtube.com/watch?v=TSUvGqRFlug​ (timeStamp: 2:00)
5. https://www.codechef.com/COW42020/problems/COW3E/​ (2d prefix sum)
6. https://www.codechef.com/problems/COWA19B
7. https://www.codechef.com/problems/MXPOWER

Sliding Window:
1. https://www.hackerrank.com/challenges/min-max-riddle/problem
2. https://codeforces.com/problemset/problem/363/B
3. https://www.codechef.com/problems/SHIVIGOD​ (try to do using sliding
window)
4. https://www.codechef.com/problems/BDGFT
5. https://www.codechef.com/problems/ECAPR206
6. https://codeforces.com/problemset/problem/1341/B
7. https://www.codechef.com/problems/SUMPOWER​ (Can be solved using
prefix sum, but try to do without that by using O(1) space)

Binary Search​:
(make sure you watch STL of BS ->
https://www.youtube.com/watch?v=edJ19qIL8WQ​)
1. https://www.hackerearth.com/practice/algorithms/searching/binary-search/pra
ctice-problems/algorithm/bishu-and-soldiers/
2. https://www.spoj.com/problems/AGGRCOW/
3. https://www.interviewbit.com/problems/painters-partition-problem/
4. https://codeforces.com/problemset/problem/975/C
5. https://www.codechef.com/problems/DSTROY
6. https://codeforces.com/problemset/problem/812/C
7. https://codeforces.com/problemset/problem/363/D
8. https://www.codechef.com/problems/FAKEBS

Prime, Sieve, Segmented Sieve, Prime Factorisation:


1. https://www.spoj.com/problems/PRIME1/
2. https://www.spoj.com/problems/TDPRIMES/
3. https://www.hackerearth.com/practice/math/number-theory/basic-number-the
ory-2/practice-problems/algorithm/nearest-prime-a828361b/
4. https://www.hackerearth.com/practice/math/number-theory/basic-number-the
ory-2/practice-problems/algorithm/ashu-and-prime-factors-4/
5. https://codeforces.com/contest/776/problem/B
6. https://www.hackerearth.com/practice/math/number-theory/basic-number-the
ory-2/practice-problems/algorithm/b-prime-counting/description/
7. https://www.hackerearth.com/practice/math/number-theory/primality-tests/pra
ctice-problems/algorithm/bob-and-gems-f8226fbd/description/
8. https://codeforces.com/contest/546/problem/D
9. https://codeforces.com/problemset/problem/222/C

Search Combinatorics problems and do by self, since it is not an algorithm, rather


mathematics, whose pattern can never be understood ;)

Constructive Problems having swapping terms in it:


1. https://codeforces.com/problemset/problem/1353/B
2. https://codeforces.com/problemset/problem/489/A
3. https://codeforces.com/problemset/problem/920/C
4. https://codeforces.com/problemset/problem/1215/C
5. https://www.codechef.com/problems/SWAPPALI

Bit Manipulation/Power Set:


1. https://www.hackerearth.com/practice/basic-programming/bit-manipulation/ba
sics-of-bit-manipulation/practice-problems/algorithm/find-the-numbers-75f249
49/
2. https://www.hackerearth.com/practice/basic-programming/bit-manipulation/ba
sics-of-bit-manipulation/practice-problems/algorithm/power-of-2-6/
3. https://codeforces.com/problemset/problem/1095/C
4. https://codeforces.com/problemset/problem/1202/A
5. https://codeforces.com/problemset/problem/1152/B
6. https://codeforces.com/problemset/problem/611/B
7. https://codeforces.com/problemset/problem/1097/B​ (Power Set use)
8. https://codeforces.com/problemset/problem/276/D

Greedy Algorithms (A topic in which you need to many many problems)​:


1. https://codeforces.com/problemset/problem/1291/A
2. https://codeforces.com/problemset/problem/1375/B
3. https://codeforces.com/problemset/problem/1294/C
4. https://codeforces.com/problemset/problem/1285/B​ (Kadane’s Algo pre-req)
5. https://codeforces.com/problemset/problem/1201/B
6. https://codeforces.com/problemset/problem/274/A
7. https://codeforces.com/problemset/problem/413/C
8. https://codeforces.com/problemset/problem/1368/B
9. https://codeforces.com/problemset/problem/1291/B

Divide and Conquer:


1. https://leetcode.com/problems/reverse-pairs/​ (Check my video on YT)
2. https://codeforces.com/problemset/problem/768/B
3. https://cses.fi/problemset/task/1628
4. https://codeforces.com/problemset/problem/1263/C​ (try to solve using MIM)
5. https://codeforces.com/problemset/problem/1249/C2
6. https://codeforces.com/problemset/problem/1373/D

Stack/Queues/PriorityQueues:
1. https://www.hackerrank.com/challenges/balanced-brackets/problem
2. https://www.codechef.com/status/THESA
3. https://www.spoj.com/problems/ANARC09A/
4. https://www.hackerearth.com/practice/data-structures/queues/basics-of-queu
es/practice-problems/algorithm/monk-and-power-of-time-3a648bf0/
5. https://www.hackerearth.com/challenges/competitive/code-monk-heaps-and-p
riority-queues-1/algorithm/little-monk-and-williamson/
6. https://codeforces.com/contest/5/problem/C
7. https://www.hackerearth.com/practice/data-structures/stacks/basics-of-stacks/
practice-problems/algorithm/little-shino-and-pairs/
8. https://www.hackerearth.com/practice/data-structures/trees/heapspriority-que
ues/practice-problems/algorithm/seating-arrangement-6b8562ad/

String Algorithms(Hashing, Rabin Karp, KMP, Z-Function, Manacher’s Algo):


1. http://codeforces.com/problemset/problem/271/D
2. https://www.spoj.com/problems/NHAY/
3. https://www.spoj.com/problems/NAJPF/
4. https://onlinejudge.org/index.php?option=onlinejudge&page=show_problem&
problem=396
5. http://codeforces.com/problemset/problem/126/B
6. http://codeforces.com/problemset/problem/271/D
7. https://www.codechef.com/problems/RUNNING
8. https://www.codechef.com/problems/INSQ15_A
9. https://codeforces.com/problemset/problem/346/B
10. https://codeforces.com/problemset/problem/432/D​ (Trees must be known)
11. https://leetcode.com/problems/longest-palindromic-substring/​ (Manacher’s)
12. https://leetcode.com/problems/longest-palindromic-substring/
13. https://codeforces.com/contest/1080/problem/E​ (Super tough)

Tree’s (DFS, LCA, Subtree size .. ) :

1. https://cses.fi/problemset/task/1674
2. https://cses.fi/problemset/task/1130
3. https://www.spoj.com/problems/ABCPATH/
4. https://cses.fi/problemset/task/1131
5. https://codeforces.com/problemset/problem/1336/A
6. https://codeforces.com/contest/734/problem/E​ (Bit tougher DFS)
7. https://cses.fi/problemset/task/1688​ (LCA)
8. https://www.spoj.com/problems/DISQUERY/
9. https://cses.fi/problemset/task/1131​ (LCA)
10. https://cses.fi/problemset/task/1135​ (LCA)
11. https://codeforces.com/contest/208/problem/E
12. https://codeforces.com/contest/1328/problem/E
13. https://codeforces.com/contest/519/problem/E
14. Still want more for LCA, find here -> ​https://codeforces.com/blog/entry/43917

Graph Algorithms (DFS, BFS, Dijsktra, Floyd Washall, Bellman Ford, Bridges,
0-1 BFS, Bipartite, Topo-sort ...) ​:
1. https://cses.fi/problemset/task/1192​ (bfs)
2. https://cses.fi/problemset/task/1193
3. https://codeforces.com/problemset/problem/242/C
4. https://cses.fi/problemset/task/1193​ (Connected Components)
5. https://cses.fi/problemset/task/1667
6. https://cses.fi/problemset/task/1669
7. https://cses.fi/problemset/task/1671​ (Dijsktra)
8. https://codeforces.com/problemset/problem/20/C
9. https://cses.fi/problemset/task/1672​ (Floyd Warshall)
10. https://cses.fi/problemset/task/1673
11. https://cses.fi/problemset/task/1197​ (Bellman Ford)
12. https://cses.fi/problemset/task/1679​ (topo sort)
13. https://codeforces.com/problemset/problem/510/C
14. https://codeforces.com/problemset/problem/59/E​ (tough Dijsktra)
15. https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=s
how_problem&problem=737
16. https://www.spoj.com/problems/SUBMERGE/
17. https://www.codechef.com/problems/REVERSE​ (0-1 BFS)
18. https://codeforces.com/contest/1296/problem/E1​ (Bipartite)

Once you have done this, if you feel like doing more, search and do as much
as you can on the algo names above..

Dynamic Programming:
1. https://atcoder.jp/contests/dp/tasks/dp_a
2. https://atcoder.jp/contests/dp/tasks/dp_b
3. https://atcoder.jp/contests/dp/tasks/dp_c
4. https://atcoder.jp/contests/dp/tasks/dp_d
5. https://atcoder.jp/contests/dp/tasks/dp_e
6. https://atcoder.jp/contests/dp/tasks/dp_f
7. https://atcoder.jp/contests/dp/tasks/dp_h
8. https://atcoder.jp/contests/dp/tasks/dp_i
9. https://cses.fi/problemset/task/1635
10. https://cses.fi/problemset/task/1636
11. https://codeforces.com/problemset/problem/1015/E1
12. https://codeforces.com/problemset/problem/977/F
13. https://codeforces.com/problemset/problem/1155/D
14. https://codeforces.com/problemset/problem/1341/D​ (I also have a video on
this, do check out)
15. https://vjudge.net/problem/LightOJ-1068
16. https://vjudge.net/problem/LightOJ-1205
17. https://www.codechef.com/problems/DGTCNT
18. https://www.spoj.com/problems/CPCRC1C/
19. https://www.spoj.com/problems/PR003004/
20. https://codeforces.com/contest/628/problem/D

Disjoint Set​:
1. https://www.hackerearth.com/practice/data-structures/disjoint-data-strutures/b
asics-of-disjoint-data-structures/practice-problems/algorithm/owl-fight/
2. https://www.hackerearth.com/practice/data-structures/disjoint-data-strutures/b
asics-of-disjoint-data-structures/practice-problems/algorithm/still-maximum/
3. https://codeforces.com/contest/25/problem/D
4. https://www.spoj.com/problems/CLFLARR/​ (offline)
5. https://codeforces.com/contest/151/problem/D
6. https://codeforces.com/problemset/problem/547/B

Sqrt Decomposition:
1. ​https://www.hackerearth.com/problem/algorithm/gcd-problem-1/
2. https://www.hackerearth.com/problem/algorithm/final-question/
3. https://codeforces.com/contest/220/problem/B
4. https://codeforces.com/contest/86/problem/D​ (Mo’s Algo)
5. https://codeforces.com/contest/242/problem/E
6.
Fenwick Tree:
1. https://www.spoj.com/problems/INVCNT/
2. https://codeforces.com/gym/100741/problem/A
3. https://www.spoj.com/problems/MATSUM/
4. https://codeforces.com/gym/100741/problem/A
5. https://www.spoj.com/problems/DQUERY/
6. https://codeforces.com/problemset/problem/61/E

Segment Tree(lazy also included):


1. https://cses.fi/problemset/task/1646
2. https://cses.fi/problemset/task/1647
3. https://codeforces.com/problemset/problem/61/E
4. https://codeforces.com/contest/356/problem/A
5. https://codeforces.com/contest/459/problem/D
6. https://codeforces.com/contest/61/problem/E
7. https://codeforces.com/contest/380/problem/C
8. https://www.hackerearth.com/practice/data-structures/advanced-data-structur
es/fenwick-binary-indexed-trees/practice-problems/algorithm/help-ashu-1/
9. https://codeforces.com/contest/52/problem/C
10. https://codeforces.com/contest/52/problem/C
11. https://codeforces.com/contest/558/problem/E
12. ​https://codeforces.com/contest/558/problem/E
13. https://codeforces.com/contest/558/problem/E
Questions by Love Babbar:
Youtube Channel: https://www.youtube.com/channel/UCQHLxxBFrbfdrk1jF0moTpw

Topic: Problem: Done

Array 1 Reverse the array Yes


Array 2 Find the maximum and minimum element in an array

Array 3 Find the "Kth" max and min element of an array

Array 4 Given an array which consists of only 0, 1 and 2. Sort the array without using any sorting algo

Array 5 Move all the negative elements to one side of the array

Array 6 Find the Union and Intersection of the two sorted arrays.

Array 7 Write a program to cyclically rotate an array by one.

Array 8 find Largest sum contiguous Subarray [V. IMP] Yes standard kadane algorithm

Array 9 Minimise the maximum difference between heights [V.IMP]

Array 10 Minimum no. of Jumps to reach end of an array

Array 11 find duplicate in an array of N+1 Integers

Array 12 Merge 2 sorted arrays without using Extra space.

Array 13 Kadane's Algo [V.V.V.V.V IMP]

Array 14 Merge Intervals

Array 15 Next Permutation

Array 16 Count Inversion

Array 17 Best time to buy and Sell stock

Array 18 find all pairs on integer array whose sum is equal to given number

Array 19 find common elements In 3 sorted arrays

Array 20 Rearrange the array in alternating positive and negative items with O(1) extra space

Array 21 Find if there is any subarray with sum equal to 0

Array 22 Find factorial of a large number

Array 23 find maximum product subarray DP STRIVER

Array 24 Find longest coinsecutive subsequence

Array 25 Given an array of size n and a number k, fin all elements that appear more than " n/k " times.
Array 26 Maximum profit by buying and selling a share atmost twice

Array 27 Find whether an array is a subset of another array

Array 28 Find the triplet that sum to a given value

Array 29 Trapping Rain water problem

Array 30 Chocolate Distribution problem

Array 31 Smallest Subarray with sum greater than a given value

Array 32 Three way partitioning of an array around a given value

Array 33 Minimum swaps required bring elements less equal K together

Array 34 Minimum no. of operations required to make an array palindrome

Array 35 Median of 2 sorted arrays of equal size

Array 36 Median of 2 sorted arrays of different size

Matrix 1 Spiral traversal on a Matrix

Matrix 2 Search an element in a matriix

Matrix 3 Find median in a row wise sorted matrix

Matrix 4 Find row with maximum no. of 1's

Matrix 5 Print elements in sorted order using row-column wise sorted matrix

Matrix 6 Maximum size rectangle

Matrix 7 Find a specific pair in matrix

Matrix 8 Rotate matrix by 90 degrees

Matrix 9 Kth smallest element in a row-cpumn wise sorted matrix

Matrix 10 Common elements in all rows of a given matrix

String 1 Reverse a String

String 2 Check whether a String is Palindrome or not

String 3 Find Duplicate characters in a string

String 4 Why strings are immutable in Java?

String 5 Write a Code to check whether one string is a rotation of another

String 6 Write a Program to check whether a string is a valid shuffle of two strings or not

String 7 Count and Say problem

String 8 Write a program to find the longest Palindrome in a string.[ Longest palindromic Substring]
String 9 Find Longest Recurring Subsequence in String

String 10 Print all Subsequences of a string.

String 11 Print all the permutations of the given string

String 12 Split the Binary string into two substring with equal 0’s and 1’s

String 13 Word Wrap Problem [VERY IMP].

String 14 EDIT Distance [Very Imp] DP STRIVER

String 15 Find next greater number with same set of digits. [Very Very IMP]

String 16 Balanced Parenthesis problem.[Imp]

String 17 Word break Problem[ Very Imp]

String 18 Rabin Karp Algo

String 19 KMP Algo

String 20 Convert a Sentence into its equivalent mobile numeric keypad sequence.

String 21 Minimum number of bracket reversals needed to make an expression balanced.

String 22 Count All Palindromic Subsequence in a given String.

String 23 Count of number of given string in 2D character array

String 24 Search a Word in a 2D Grid of characters.

String 25 Boyer Moore Algorithm for Pattern Searching.

String 26 Converting Roman Numerals to Decimal

String 27 Longest Common Prefix

String 28 Number of flips to make binary string alternate

String 29 Find the first repeated word in string.

String 30 Minimum number of swaps for bracket balancing.

String 31 Find the longest common subsequence between two strings.

String 32 Program to generate all possible valid IP addresses from given string.

String 33 Write a program tofind the smallest window that contains all characters of string itself.

String 34 Rearrange characters in a string such that no two adjacent are same

String 35 Minimum characters to be added at front to make string palindrome

String 36 Given a sequence of words, print all anagrams together

String 37 Find the smallest window in a string containing all characters of another string

String 38 Recursively remove all adjacent duplicates

String 39 String matching where one string contains wildcard characters

String 40 Function to find Number of customers who could not get a computer

String 41 Transform One String to Another using Minimum Number of Given Operation
String 42 Check if two given strings are isomorphic to each other

String 43 Recursively print all sentences that can be formed from list of word lists

Searching & Sorting 1 Find first and last positions of an element in a sorted array binary

Searching & Sorting 2 Find a Fixed Point (Value equal to index) in a given array binary

Searching & Sorting 3 Search in a rotated sorted array binary

Searching & Sorting 4 square root of an integer binary

Searching & Sorting 5 Maximum and minimum of an array using minimum number of comparisons

Searching & Sorting 6 Optimum location of point to minimize total distance

Searching & Sorting 7 Find the repeating and the missing

Searching & Sorting 8 find majority element

Searching & Sorting 9 Searching in an array where adjacent differ by at most k

Searching & Sorting 10 find a pair with a given difference

Searching & Sorting 11 find four elements that sum to a given value

Searching & Sorting 12 Implement Merge-sort in-place

Searching & Sorting 13 Count triplet with sum smaller than a given value

Searching & Sorting 14 merge 2 sorted arrays

Searching & Sorting 15 print all subarrays with 0 sum

Searching & Sorting 16 Product array Puzzle

Searching & Sorting 17 Sort array according to count of set bits

Searching & Sorting 18 minimum no. of swaps required to sort the array

Searching & Sorting 19 Bishu and Soldiers

Searching & Sorting 20 Rasta and Kheshtak

Searching & Sorting 21 Kth smallest number again

Searching & Sorting 22 Find pivot element in a sorted array

Searching & Sorting 23 K-th Element of Two Sorted Arrays

Searching & Sorting 24 Aggressive cows

Searching & Sorting 25 Book Allocation Problem

Searching & Sorting 26 EKOSPOJ: Yes

Searching & Sorting 27 Job Scheduling Algo

Searching & Sorting 28 Missing Number in AP

Searching & Sorting 29 Smallest number with atleastn trailing zeroes infactorial
Searching & Sorting 30 Painters Partition Problem:

Searching & Sorting 31 ROTI-Prata SPOJ

Searching & Sorting 32 DoubleHelix SPOJ

Searching & Sorting 33 Subset Sums

Searching & Sorting 34 Findthe inversion count

Searching & Sorting 35 Implement Merge-sort in-place

Searching & Sorting 36 Partitioning and Sorting Arrays with Many Repeated Entries

LinkedList 1 Write a Program to reverse the Linked List. (Both Iterative and recursive)

LinkedList 2 Reverse a Linked List in group of Given Size. [Very Imp]

LinkedList 3 Write a program to Detect loop in a linked list.

LinkedList 4 Write a program to Delete loop in a linked list.

LinkedList 5 Find the starting point of the loop.

LinkedList 6 Remove Duplicates in a sorted Linked List.

LinkedList 7 Remove Duplicates in a Un-sorted Linked List.

LinkedList 8 Write a Program to Move the last element to Front in a Linked List.

LinkedList 9 Add “1” to a number represented as a Linked List.

LinkedList 10 Add two numbers represented by linked lists.

LinkedList 11 Intersection of two Sorted Linked List.

LinkedList 12 Intersection Point of two Linked Lists.

LinkedList 13 Merge Sort For Linked lists.[Very Important]

LinkedList 14 Quicksort for Linked Lists.[Very Important]

LinkedList 15 Find the middle Element of a linked list.

LinkedList 16 Check if a linked list is a circular linked list.

LinkedList 17 Split a Circular linked list into two halves.

LinkedList 18 Write a Program to check whether the Singly Linked list is a palindrome or not.

LinkedList 19 Deletion from a Circular Linked List.

LinkedList 20 Reverse a Doubly Linked list.

LinkedList 21 Find pairs with a given sum in a DLL.

LinkedList 22 Count triplets in a sorted DLL whose sum is equal to given value “X”.

LinkedList 23 Sort a “k”sorted Doubly Linked list.[Very IMP]

LinkedList 24 Rotate DoublyLinked list by N nodes.


LinkedList 25 Rotate a Doubly Linked list in group of Given Size.[Very IMP]

LinkedList 26 Can we reverse a linked list in less than O(n) ?

LinkedList 27 Why Quicksort is preferred for. Arrays and Merge Sort for LinkedLists ?

LinkedList 28 Flatten a Linked List

LinkedList 29 Sort a LL of 0's, 1's and 2's

LinkedList 30 Clone a linked list with next and random pointer

LinkedList 31 Merge K sorted Linked list

LinkedList 32 Multiply 2 no. represented by LL

LinkedList 33 Delete nodes which have a greater value on right side

LinkedList 34 Segregate even and odd nodes in a Linked List

LinkedList 35 Program for n’th node from the end of a Linked List

LinkedList 36 Find the first non-repeating character from a stream of characters

Binary Trees 1 level order traversal

Binary Trees 2 Reverse Level Order traversal

Binary Trees 3 Height of a tree

Binary Trees 4 Diameter of a tree

Binary Trees 5 Mirror of a tree

Binary Trees 6 Inorder Traversal of a tree both using recursion and Iteration

Binary Trees 7 Preorder Traversal of a tree both using recursion and Iteration

Binary Trees 8 Postorder Traversal of a tree both using recursion and Iteration

Binary Trees 9 Left View of a tree

Binary Trees 10 Right View of Tree

Binary Trees 11 Top View of a tree

Binary Trees 12 Bottom View of a tree

Binary Trees 13 Zig-Zag traversal of a binary tree

Binary Trees 14 Check if a tree is balanced or not

Binary Trees 15 Diagnol Traversal of a Binary tree

Binary Trees 16 Boundary traversal of a Binary tree

Binary Trees 17 Construct Binary Tree from String with Bracket Representation

Binary Trees 18 Convert Binary tree into Doubly Linked List

Binary Trees 19 Convert Binary tree into Sum tree


Binary Trees 20 Construct Binary tree from Inorder and preorder traversal

Binary Trees 21 Find minimum swaps required to convert a Binary tree into BST

Binary Trees 22 Check if Binary tree is Sum tree or not

Binary Trees 23 Check if all leaf nodes are at same level or not

Binary Trees 24 Check if a Binary Tree contains duplicate subtrees of size 2 or more [ IMP ]

Binary Trees 25 Check if 2 trees are mirror or not

Binary Trees 26 Sum of Nodes on the Longest path from root to leaf node

Binary Trees 27 Check if given graph is tree or not. [ IMP ]

Binary Trees 28 Find Largest subtree sum in a tree

Binary Trees 29 Maximum Sum of nodes in Binary tree such that no two are adjacent

Binary Trees 30 Print all "K" Sum paths in a Binary tree

Binary Trees 31 Find LCA in a Binary tree

Binary Trees 32 Find distance between 2 nodes in a Binary tree

Binary Trees 33 Kth Ancestor of node in a Binary tree

Binary Trees 34 Find all Duplicate subtrees in a Binary tree [ IMP ]

Binary Trees 35 Tree Isomorphism Problem

Binary Search Trees 1 Fina a value in a BST

Binary Search Trees 2 Deletion of a node in a BST

Binary Search Trees 3 Find min and max value in a BST

Binary Search Trees 4 Find inorder successor and inorder predecessor in a BST

Binary Search Trees 5 Check if a tree is a BST or not

Binary Search Trees 6 Populate Inorder successor of all nodes

Binary Search Trees 7 Find LCA of 2 nodes in a BST

Binary Search Trees 8 Construct BST from preorder traversal

Binary Search Trees 9 Convert Binary tree into BST

Binary Search Trees 10 Convert a normal BST into a Balanced BST

Binary Search Trees 11 Merge two BST [ V.V.V>IMP ]

Binary Search Trees 12 Find Kth largest element in a BST

Binary Search Trees 13 Find Kth smallest element in a BST

Binary Search Trees 14 Count pairs from 2 BST whose sum is equal to given value "X"

Binary Search Trees 15 Find the median of BST in O(n) time and O(1) space
Binary Search Trees 16 Count BST ndoes that lie in a given range

Binary Search Trees 17 Replace every element with the least greater element on its right

Binary Search Trees 18 Given "n" appointments, find the conflicting appointments

Binary Search Trees 19 Check preorder is valid or not

Binary Search Trees 20 Check whether BST contains Dead end

Binary Search Trees 21 Largest BST in a Binary Tree [ V.V.V.V.V IMP ]

Binary Search Trees 22 Flatten BST to sorted list

Greedy 1 Activity Selection Problem Yes sort acc. to end time

Greedy 2 Job SequencingProblem Doubt

Greedy 3 Huffman Coding No binary tree use

Greedy 4 Water Connection Problem

Greedy 5 Fractional Knapsack Problem Yes

Greedy 6 Greedy Algorithm to find Minimum number of Coins No

Greedy 7 Maximum trains for which stoppage can be provided Yes good coding/same as activity selection

Greedy 8 Minimum Platforms Problem

Greedy 9 Buy Maximum Stocks if i stocks can be bought on i-th day

Greedy 10 Find the minimum and maximum amount to buy all N candies

Greedy 11 Minimize Cash Flow among a given set of friends who have borrowed money from each other

Greedy 12 Minimum Cost to cut a board into squares

Greedy 13 Check if it is possible to survive on Island

Greedy 14 Find maximum meetings in one room

Greedy 15 Maximum product subset of an array

Greedy 16 Maximize array sum after K negations

Greedy 17 Maximize the sum of arr[i]*i

Greedy 18 Maximum sum of absolute difference of an array

Greedy 19 Maximize sum of consecutive differences in a circular array

Greedy 20 Minimum sum of absolute difference of pairs of two arrays

Greedy 21 Program for Shortest Job First (or SJF) CPU Scheduling

Greedy 22 Program for Least Recently Used (LRU) Page Replacement algorithm

Greedy 23 Smallest subset with sum greater than all other elements

Greedy 24 Chocolate Distribution Problem


Greedy 25 DEFKIN -Defense of a Kingdom

Greedy 26 DIEHARD -DIE HARD Revise jyada hi greedy sochna hai

Greedy 27 GERGOVIA -Wine trading in Gergovia Doubt

Greedy 28 Picking Up Chicks

Greedy 29 CHOCOLA –Chocolate No

Greedy 30 ARRANGE -Arranging Amplifiers

Greedy 31 K Centers Problem

Greedy 32 Minimum Cost of ropes

Greedy 33 Find smallest number with given number of digits and sum of digits

Greedy 34 Rearrange characters in a string such that no two adjacent are same

Greedy 35 Find maximum sum possible equal sum of three stacks

BackTracking 1 Rat in a maze Problem

BackTracking 2 Printing all solutions in N-Queen Problem

BackTracking 3 Word Break Problem using Backtracking

BackTracking 4 Remove Invalid Parentheses

BackTracking 5 Sudoku Solver

BackTracking 6 m Coloring Problem

BackTracking 7 Print all palindromic partitions of a string

BackTracking 8 Subset Sum Problem

BackTracking 9 The Knight’s tour problem

BackTracking 10 Tug of War

BackTracking 11 Find shortest safe route in a path with landmines

BackTracking 12 Combinational Sum

BackTracking 13 Find Maximum number possible by doing at-most K swaps

BackTracking 14 Print all permutations of a string

BackTracking 15 Find if there is a path of more than k length from a source

BackTracking 16 Longest Possible Route in a Matrix with Hurdles

BackTracking 17 Print all possible paths from top left to bottom right of a mXn matrix

BackTracking 18 Partition of a set intoK subsets with equal sum

BackTracking 19 Find the K-th Permutation Sequence of first N natural numbers


Stacks & Queues 1 Implement Stack from Scratch

Stacks & Queues 2 Implement Queue from Scratch

Stacks & Queues 3 Implement 2 stack in an array

Stacks & Queues 4 find the middle element of a stack

Stacks & Queues 5 Implement "N" stacks in an Array

Stacks & Queues 6 Check the expression has valid or Balanced parenthesis or not.

Stacks & Queues 7 Reverse a String using Stack

Stacks & Queues 8 Design a Stack that supports getMin() in O(1) time and O(1) extra space.

Stacks & Queues 9 Find the next Greater element

Stacks & Queues 10 The celebrity Problem

Stacks & Queues 11 Arithmetic Expression evaluation

Stacks & Queues 12 Evaluation of Postfix expression

Stacks & Queues 13 Implement a method to insert an element at its bottom without using any other data structure.

Stacks & Queues 14 Reverse a stack using recursion

Stacks & Queues 15 Sort a Stack using recursion

Stacks & Queues 16 Merge Overlapping Intervals

Stacks & Queues 17 Largest rectangular Area in Histogram

Stacks & Queues 18 Length of the Longest Valid Substring

Stacks & Queues 19 Expression contains redundant bracket or not

Stacks & Queues 20 Implement Stack using Queue

Stacks & Queues 21 Implement Stack using Deque

Stacks & Queues 22 Stack Permutations (Check if an array is stack permutation of other)

Stacks & Queues 23 Implement Queue using Stack

Stacks & Queues 24 Implement "n" queue in an array

Stacks & Queues 25 Implement a Circular queue

Stacks & Queues 26 LRU Cache Implementationa

Stacks & Queues 27 Reverse a Queue using recursion

Stacks & Queues 28 Reverse the first “K” elements of a queue

Stacks & Queues 29 Interleave the first half of the queue with second half

Stacks & Queues 30 Find the first circular tour that visits all Petrol Pumps

Stacks & Queues 31 Minimum time required to rot all oranges

Stacks & Queues 32 Distance of nearest cell having 1 in a binary matrix


Stacks & Queues 33 First negative integer in every window of size “k”

Stacks & Queues 34 Check if all levels of two trees are anagrams or not.

Stacks & Queues 35 Sum of minimum and maximum elements of all subarrays of size “k”.

Stacks & Queues 36 Minimum sum of squares of character counts in a given string after removing “k” characters.

Stacks & Queues 37 Queue based approach or first non-repeating character in a stream.

Stacks & Queues 38 Next Smaller Element

Heap 1 Implement a Maxheap/MinHeap using arrays and recursion.

Heap 2 Sort an Array using heap. (HeapSort)

Heap 3 Maximum of all subarrays of size k.

Heap 4 “k” largest element in an array

Heap 5 Kth smallest and largest element in an unsorted array

Heap 6 Merge “K” sorted arrays. [ IMP ]

Heap 7 Merge 2 Binary Max Heaps

Heap 8 Kth largest sum continuous subarrays

Heap 9 Leetcode- reorganize strings

Heap 10 Merge “K” Sorted Linked Lists [V.IMP]

Heap 11 Smallest range in “K” Lists

Heap 12 Median in a stream of Integers

Heap 13 Check if a Binary Tree is Heap

Heap 14 Connect “n” ropes with minimum cost

Heap 15 Convert BST to Min Heap

Heap 16 Convert min heap to max heap

Heap 17 Rearrange characters in a string such that no two adjacent are same.

Heap 18 Minimum sum of two numbers formed from digits of an array

Graph 1 Create a Graph, print it

Graph 2 Implement BFS algorithm

Graph 3 Implement DFS Algo

Graph 4 Detect Cycle in Directed Graph using BFS/DFS Algo

Graph 5 Detect Cycle in UnDirected Graph using BFS/DFS Algo


Graph 6 Search in a Maze

Graph 7 Minimum Step by Knight

Graph 8 flood fill algo

Graph 9 Clone a graph

Graph 10 Making wired Connections

Graph 11 word Ladder

Graph 12 Dijkstra algo

Graph 13 Implement Topological Sort

Graph 14 Minimum time taken by each job to be completed given by a Directed Acyclic Graph

Graph 15 Find whether it is possible to finish all tasks or not from given dependencies

Graph 16 Find the no. of Isalnds

Graph 17 Given a sorted Dictionary of an Alien Language, find order of characters

Graph 18 Implement Kruksal’sAlgorithm

Graph 19 Implement Prim’s Algorithm

Graph 20 Total no. of Spanning tree in a graph

Graph 21 Implement Bellman Ford Algorithm

Graph 22 Implement Floyd warshallAlgorithm

Graph 23 Travelling Salesman Problem

Graph 24 Graph ColouringProblem

Graph 25 Snake and Ladders Problem

Graph 26 Find bridge in a graph

Graph 27 Count Strongly connected Components(Kosaraju Algo)

Graph 28 Check whether a graph is Bipartite or Not

Graph 29 Detect Negative cycle in a graph

Graph 30 Longest path in a Directed Acyclic Graph

Graph 31 Journey to the Moon

Graph 32 Cheapest Flights Within K Stops

Graph 33 Oliver and the Game

Graph 34 Water Jug problem using BFS

Graph 35 Water Jug problem using BFS

Graph 36 Find if there is a path of more thank length from a source

Graph 37 M-ColouringProblem

Graph 38 Minimum edges to reverse o make path from source to destination


Graph 39 Paths to travel each nodes using each edge(Seven Bridges)

Graph 40 Vertex Cover Problem

Graph 41 Chinese Postman or Route Inspection

Graph 42 Number of Triangles in a Directed and Undirected Graph

Graph 43 Minimise the cashflow among a given set of friends who have borrowed money from each other

Graph 44 Two Clique Problem

Trie 1 Construct a trie from scratch

Trie 2 Find shortest unique prefix for every word in a given list

Trie 3 Word Break Problem | (Trie solution)

Trie 4 Given a sequence of words, print all anagrams together

Trie 5 Implement a Phone Directory

Trie 6 Print unique rows in a given boolean matrix

Dynamic Programming 1 Coin ChangeProblem

Dynamic Programming 2 Knapsack Problem Yes

Dynamic Programming 3 Binomial CoefficientProblem Yes use nCr=n-1Cr+n-1Cr-1

Dynamic Programming 4 Permutation CoefficientProblem

Dynamic Programming 5 Program for nth Catalan Number

Dynamic Programming 6 Matrix Chain Multiplication

Dynamic Programming 7 Edit Distance

Dynamic Programming 8 Subset Sum Problem

Dynamic Programming 9 Friends Pairing Problem

Dynamic Programming 10 Gold Mine Problem

Dynamic Programming 11 Assembly Line SchedulingProblem

Dynamic Programming 12 Painting the Fenceproblem

Dynamic Programming 13 Maximize The Cut Segments

Dynamic Programming 14 Longest Common Subsequence

Dynamic Programming 15 Longest Repeated Subsequence

Dynamic Programming 16 Longest Increasing Subsequence Yes easy but need to remember dp trick

Dynamic Programming 17 Space Optimized Solution of LCS


Dynamic Programming 18 LCS (Longest Common Subsequence) of three strings

Dynamic Programming 19 Maximum Sum Increasing Subsequence

Dynamic Programming 20 Count all subsequences having product less than K

Dynamic Programming 21 Longest subsequence such that difference between adjacent is one

Dynamic Programming 22 Maximum subsequence sum such that no three are consecutive

Dynamic Programming 23 Egg Dropping Problem

Dynamic Programming 24 Maximum Length Chain of Pairs

Dynamic Programming 25 Maximum size square sub-matrix with all 1s

Dynamic Programming 26 Maximum sum of pairs with specific difference

Dynamic Programming 27 Min Cost PathProblem

Dynamic Programming 28 Maximum difference of zeros and ones in binary string

Dynamic Programming 29 Minimum number of jumps to reach end

Dynamic Programming 30 Minimum cost to fill given weight in a bag

Dynamic Programming 31 Minimum removals from array to make max –min <= K

Dynamic Programming 32 Longest Common Substring

Dynamic Programming 33 Count number of ways to reacha given score in a game

Dynamic Programming 34 Count Balanced Binary Trees of Height h

Dynamic Programming 35 LargestSum Contiguous Subarray [V>V>V>V IMP ]

Dynamic Programming 36 Smallest sum contiguous subarray

Dynamic Programming 37 Unbounded Knapsack (Repetition of items allowed)

Dynamic Programming 38 Word Break Problem

Dynamic Programming 39 Largest Independent Set Problem

Dynamic Programming 40 Partition problem

Dynamic Programming 41 Longest Palindromic Subsequence

Dynamic Programming 42 Count All Palindromic Subsequence in a given String

Dynamic Programming 43 Longest Palindromic Substring

Dynamic Programming 44 Longest alternating subsequence

Dynamic Programming 45 Weighted Job Scheduling

Dynamic Programming 46 Coin game winner where every player has three choices

Dynamic Programming 47 Count Derangements (Permutation such that no element appears in its original position) [ IMPORTANT ]

Dynamic Programming 48 Maximum profit by buying and selling a share at most twice [ IMP ]

Dynamic Programming 49 Optimal Strategy for a Game

Dynamic Programming 50 Optimal Binary Search Tree


Dynamic Programming 51 Palindrome PartitioningProblem

Dynamic Programming 52 Word Wrap Problem

Dynamic Programming 53 Mobile Numeric Keypad Problem [ IMP ]

Dynamic Programming 54 Boolean Parenthesization Problem

Dynamic Programming 55 Largest rectangular sub-matrix whose sum is 0

Dynamic Programming 56 Largest area rectangular sub-matrix with equal number of 1’s and 0’s [ IMP ]

Dynamic Programming 57 Maximum sum rectangle in a 2D matrix

Dynamic Programming 58 Maximum profit by buying and selling a share at most k times

Dynamic Programming 59 Find if a string is interleaved of two other strings

Dynamic Programming 60 Maximum Length of Pair Chain

Bit Manipulation 1 Count set bits in an integer

Bit Manipulation 2 Find the two non-repeating elements in an array of repeating elements

Bit Manipulation 3 Count number of bits to be flipped to convert A to B

Bit Manipulation 4 Count total set bits in all numbers from 1 to n

Bit Manipulation 5 Program to find whether a no is power of two

Bit Manipulation 6 Find position of the only set bit

Bit Manipulation 7 Copy set bits in a range

Bit Manipulation 8 Divide two integers without using multiplication, division and mod operator

Bit Manipulation 9 Calculate square of a number without using *, / and pow()

Bit Manipulation 10 Power Set


To know the entire list and other stuffs like Projects, Resume, how to give
interviews….watch the entire video at:
https://www.youtube.com/watch?v=WNtzUR_MwUQ

Find the placement series at: http://bit.ly/placementSeries

Subscribe to the channel. :) (take U forward) (striver_79)


(Channel run by ex-Amazon | Media.net(Directi) | GFG) employee, CM at Codeforces and 6*
at Codechef)

Only start doing these problems if you feel you are comfortable with solving basic problems
of DSA. Once you are, you can start preparing for these problems, because these problems
are solely interview based.

Day1: (Arrays)

1. Find the duplicate in an array of N+1 integers.


https://www.youtube.com/watch?v=32Ll35mhWg0&list=PLgUwDviBIf0rPG3Ictpu74Y
WBQ1CaBkm2&index=1​ (Problem link in description)

2. Sort an array of 0’s 1’s 2’s without using extra space or sorting algo
https://www.youtube.com/watch?v=oaVa-9wmpns&list=PLgUwDviBIf0rPG3Ictpu74Y
WBQ1CaBkm2&index=2​ (Problem link in description)

3. Repeat and Missing Number


https://www.youtube.com/watch?v=5nMGY4VUoRY&list=PLgUwDviBIf0rPG3Ictpu74
YWBQ1CaBkm2&index=3​ (Problem link in description)

4. Merge two sorted Arrays without extra space


https://www.youtube.com/watch?v=hVl2b3bLzBw&list=PLgUwDviBIf0rPG3Ictpu74Y
WBQ1CaBkm2&index=4​ (Problem link in description)

5. Kadane’s Algorithm
https://www.youtube.com/watch?v=w_KEocd__20&list=PLgUwDviBIf0rPG3Ictpu74Y
WBQ1CaBkm2&index=5

6. Merge Overlapping Subintervals


https://www.youtube.com/watch?v=2JzRBPFYbKE&list=PLgUwDviBIf0rPG3Ictpu74Y
WBQ1CaBkm2&index=6

Day2: (Arrays)
1. Set Matrix Zeros
(​https://www.youtube.com/watch?v=M65xBewcqcI&list=PLgUwDviBIf0rPG3Ictpu74Y
WBQ1CaBkm2&index=7​)
2. Pascal Triangle
https://www.youtube.com/watch?v=6FLvhQjZqvM&list=PLgUwDviBIf0rPG3Ictpu74Y
WBQ1CaBkm2&index=8

3. Next Permutation
https://www.youtube.com/watch?v=LuLCLgMElus&list=PLgUwDviBIf0rPG3Ictpu74Y
WBQ1CaBkm2&index=9

4. Inversion of Array​ (Using Merge Sort)


https://www.youtube.com/watch?v=kQ1mJlwW-c0&list=PLgUwDviBIf0rPG3Ictpu74Y
WBQ1CaBkm2&index=10
5. Stock Buy and Sell
https://www.youtube.com/watch?v=eMSfBgbiEjk&list=PLgUwDviBIf0rPG3Ictpu74YW
BQ1CaBkm2&index=11

6. Rotate Matrix
https://www.youtube.com/watch?v=Y72QeX0Efxw&list=PLgUwDviBIf0rPG3Ictpu74Y
WBQ1CaBkm2&index=12

Day3: (Arrays/maths)
1. Search in a 2D matrix
https://www.youtube.com/watch?v=ZYpYur0znng&list=PLgUwDviBIf0rPG3Ictpu74Y
WBQ1CaBkm2&index=13

2. Pow(X,n)
https://www.youtube.com/watch?v=l0YC3876qxg&list=PLgUwDviBIf0rPG3Ictpu74Y
WBQ1CaBkm2&index=14

3. Majority Element (>N/2 times)


https://www.youtube.com/watch?v=AoX3BPWNnoE&list=PLgUwDviBIf0rPG3Ictpu74
YWBQ1CaBkm2&index=15

4. Majority Element (>N/3 times)


https://www.youtube.com/watch?v=yDbkQd9t2ig&list=PLgUwDviBIf0rPG3Ictpu74YW
BQ1CaBkm2&index=16

5. Grid Unique Paths


https://www.youtube.com/watch?v=t_f0nwwdg5o&list=PLgUwDviBIf0rPG3Ictpu74YW
BQ1CaBkm2&index=17

6. Reverse Pairs (Leetcode)


https://www.youtube.com/watch?v=S6rsAlj_iB4&list=PLgUwDviBIf0rPG3Ictpu74YWB
Q1CaBkm2&index=18

7. Go through Puzzles from GFG​ (Search on own)


Day4: (Hashing)
1. 2 Sum problem
https://www.youtube.com/watch?v=dRUpbt8vHpo&list=PLgUwDviBIf0rVwua0kKYlsS
_ik_1lyVK_&index=1

2. 4 Sum problem
https://www.youtube.com/watch?v=4ggF3tXIAp0&list=PLgUwDviBIf0p4ozDR_kJJkO
Nnb1wdx2Ma&index=20

3. Longest Consecutive Sequence


https://www.youtube.com/watch?v=qgizvmgeyUM&list=PLgUwDviBIf0p4ozDR_kJJk
ONnb1wdx2Ma&index=21

4. Largest Subarray with 0 sum


https://www.youtube.com/watch?v=xmguZ6GbatA&list=PLgUwDviBIf0p4ozDR_kJJk
ONnb1wdx2Ma&index=22

5. Count number of subarrays with given XOR​(this clears a lot of problems)


https://www.youtube.com/watch?v=lO9R5CaGRPY&list=PLgUwDviBIf0p4ozDR_kJJk
ONnb1wdx2Ma&index=23

6. Longest substring without repeat


https://www.youtube.com/watch?v=qtVh-XEpsJo&list=PLgUwDviBIf0p4ozDR_kJJkO
Nnb1wdx2Ma&index=25

Day5: (LinkedList)
1. Reverse a LinkedList

2. Find middle of LinkedList

3. Merge two sorted Linked List

4. Remove N-th node from back of LinkedList

5. Delete a given Node when a node is given. (0(1) solution)

6. Add two numbers as LinkedList

Day6:
1. Find intersection point of Y LinkedList
2. Check if a LinkedList is palindrome or not.
3. Reverse a LinkedList in groups.
4. Detect a cycle and removing loop(two different questions and same concept)
5. Flattening of a LinkedList
6. Rotate a LinkedList
7. Clone a Linked List with random and next pointer.
.

Day7: (2-pointer)
1. Merge two sorted LinkedLists
2. Find the starting point of the loop.
3. 3 sum
4. Trapping rainwater
5. Remove Duplicate from Sorted array
6. Max continuous number of 1’s

Day8: (Greedy)
1. N meeting in one room
2. Activity Selection
3. Greedy algorithm to find minimum number of coins
4. Fractional Knapsack Problem
5. Minimum number of platforms required for a railway
6. Job sequencing Problem

Day9: (Backtracking)
1. N queens Problem
2. Sudoko
3. M coloring Problem (Graph prob)
4. Rat in a Maze
5. Print all Permutations of a string/array
6. Word Break (print all ways)

Day10:
1. Combination sum-1
2. Combination sum-2
3. Palindrome Partioning
4. Subset Sum-1
5. Subset Sum-2
6. K-th permutation Sequence

Day11: (Divide and Conquer)


1. 1/N-th root of an integer (use binary search) (square root, cube root, ..)
2. Matrix Median
3. Find the element that appears once in sorted array, and rest element appears twice
(Binary search)
4. Search element in a sorted and rotated array/ find pivot where it is rotated
5. Median of 2 sorted arrays
6. K-th element of two sorted arrays

Day12: (Bits) (Optional, very rare topic in interviews, but if you have time left, someone might
ask)
1. Check if a number if a power of 2 or not in O(1)
2. Count total set bits
3. Divide Integers without / operator
4. Power Set (this is very important)
5. Find MSB in o(1)
6. Find square of a number without using multiplication or division operators.

Day13: (Stack and Queue)


1. Implement Stack / Implement Queue
2. BFS
3. Implement Stack using Queue
4. Implement Queue using Stack
5. Check for balanced parentheses
6. Next Greater Element

Day14:
1. Next Smaller Element
2. LRU cache (vvvv. imp)
3. Largest rectangle in histogram
4. Sliding Window maximum
5. Implement Min Stack
6. Rotten Orange (Using BFS)

Day15: (String)
1. Reverse Words in a String
2. Longest Palindrome in a string
3. Roman Number to Integer and vice versa
4. Implement ATOI/STRSTR
5. Longest Common Prefix
6. Rabin Karp

Day16: (String)
1. Prefix Function/Z-Function
2. KMP algo
3. Minimum characters needed to be inserted in the beginning to make it palindromic.
4. Check for Anagrams
5. Count and Say
6. Compare version numbers

Day17: (Binary Tree)


1. Inorder Traversal (with recursion and without recursion)
2. Preorder Traversal (with recursion and without recursion)
3. Postorder Traversal (with recursion and without recursion)
4. LeftView Of Binary Tree
5. Bottom View of Binary Tree
6. Top View of Binary Tree
Day18: (Binary Tree)
1. Level order Traversal / Level order traversal in spiral form
2. Height of a Binary Tree
3. Diameter of Binary Tree
4. Check if Binary tree is height balanced or not
5. LCA in Binary Tree
6. Check if two trees are identical or not

Day 19: (Binary Tree)


1. Maximum path sum
2. Construct Binary Tree from inorder and preorder
3. Construct Binary Tree from Inorder and Postorder
4. Symmetric Binary Tree
5. Flatten Binary Tree to LinkedList
6. Check if Binary Tree is mirror of itself or not

Day 20: (Binary Search Tree)


1. Populate Next Right pointers of Tree
2. Search given Key in BST
3. Construct BST from given keys.
4. Check is a BT is BST or not
5. Find LCA of two nodes in BST
6. Find the inorder predecessor/successor of a given Key in BST.

Day21: (BinarySearchTree)
1. Floor and Ceil in a BST
2. Find K-th smallest and K-th largest element in BST (2 different Questions)
3. Find a pair with a given sum in BST
4. BST iterator
5. Size of the largest BST in a Binary Tree
6. Serialize and deserialize Binary Tree

Day22: (Mixed Questions)


1. Binary Tree to Double Linked List
2. Find median in a stream of running integers.
3. K-th largest element in a stream.
4. Distinct numbers in Window.
5. K-th largest element in an unsorted array.
6. Flood-fill Algorithm

Day23: (Graph)
1. Clone a graph (Not that easy as it looks)
2. DFS
3. BFS
4. Detect A cycle in Undirected Graph/Directed Graph
5. Topo Sort
6. Number of islands (Do in Grid and Graph both)
7. Bipartite Check

Day24: (Graph)
1. SCC(using KosaRaju’s algo)
2. Djisktra’s Algorithm
3. Bellman Ford Algo
4. Floyd Warshall Algorithm
5. MST using Prim’s Algo
6. MST using Kruskal’s Algo

Day25: (Dynamic Programming)


1. Max Product Subarray
2. Longest Increasing Subsequence
3. Longest Common Subsequence
4. 0-1 Knapsack
5. Edit Distance
6. Maximum sum increasing subsequence
7. Matrix Chain Multiplication

Day26: (DP)
1. Maximum sum path in matrix, (count paths, and similar type do, also backtrack to find
the maximum path)
2. Coin change
3. Subset Sum
4. Rod Cutting
5. Egg Dropping
6. Word Break
7. Palindrome Partitioning (MCM Variation)

Day27:
1. Revise OS notes that you would have made during your sem
2. If not made notes, spend 2 or 3 days and make notes from Knowledge Gate.

Day28:
1. Revise DBMS notes that you would have made during your semesters.
2. If not made notes, spend 2 or 3 days and make notes from Knowledge Gate.

Day29:
1. Revise CN notes, that you would have made during your sem.
2. If not made notes, spend 2 or 3 days and make notes from Knowledge Gate.

Day30:
1. Make a note of how will your represent your projects, and prepare all questions
related to tech which you have used in your projects. Prepare a note which you can
say for 3-10 minutes when he asks you that say something about the project.

Hurrah!! You are ready for your placement after a month of hard-work without a cheat day.

You might also like