Skip to content

Vedbhanushali/SUPREME_DSA

Repository files navigation

SUPREME_DSA

github repository of DSA challanges

1. Basics of programming

difference of endl and \n
C datatypes
ascii table
negative number storeing
Switch
Miscellaneous
Time comlexity precedence

2. Arrays

Sort zero's & one's (Dutch national flag problem)
Pascal Triangle
CODE SNIPPETS (swapping,reverse array)
Vector merge two vectors in new vector

Array Practice Questions

sort colors
move all -ve no the left side of array
find duplicate Number
missing elements from an array with duplicate
Find first occurence
Common element in 3 sorted array
Wave print a matrix
Spiral print a matrix
add two number of array
find factorial of number

3. Binary Search

binary search
find first occurrence
find last occurrence
total number of occurrences
find peak element in mountain array
find pivot element in array
search in sorted rotated array
find square root
search in nearly sorted array
Divide two numbers using binary search Binary search in 2D matrix

index based binary search

find missing elements (index based binary search)
find odd occuring element in an array

3. Sorting

Selection sort
Bubble sort
Insertion sort
STL sort custom sort

Practice Questions of searching and sorting

K-Diff Pairs In An Array
Find K-Closest Element
Exponential Search & Unbounded
Binary Search in infinite array
Book Allocation Problem
Painters Partition Problem
Aggresive Cows
EKO SPOJ
PRATA
Median or row wise sorted matrix

4. Char arrays and string

input string methods
check palindrome
remove duplicates
remove all occurrences of part from main string
valid palindrome 2
minimum time difference
palindromic substring

Practice Questions of strings

valid anagram
reverse only letters
longest common prefix
reverse vowels of as string
isomorphic string
reorganize string
group anagram
longest palindromix substring
find the index of first occurence in a string
string to integer (stoi)
string compression
Integers to Roman
Zigzag conversion
Largest number Palindrome Partitioning

Pointers and Mathematics algorithms

Seive of Erathosthenes - prime number
GCD euclid algorithm
Modulus properties
Fast exponential pow(a,b)
Pigeon hole
catalan number bst
inclusion exclusion principle
chinese reminder theorem
lucas's theorem
fermat's theorem
probability concepts

Recursion

print 1 to n
factorial
fibonaci
climbing stairs
array print all element using recursion
find max in array using recursion
finding value in array using array
print all digits of number using recursion
finding is array sorted
Binary search using recursion
Subsequence of string
Coin exchange
Cut into segement
Maximum sum of adjacent elements

Practice Questions of recursion

Last occurrence of a char
Reverse a string RE
Add string RE
palindrome check RE
Remove all occurrence of substring
print all subarrays using RE
Buy and sell stocks
House Robber
Integer to English words
Wild card Matching
Perfect squares
Minimum cost for tickets
Number of dice roll with target sum

Divide and Conquer

merge sort
In place Merge sort
quick sort

Backtracking

permutation of string
house robber problem
rate in maze
sudoko solver
N Queen
generate paranthesis
phonekeypad problem

Practice Questions of Backtracking

count inversion
inplace mergesort
max sub array sum
quicksort end element as pivot best way short
combination sum
combination sum II
permutation II
Beautiful arrangment
Distribute Repeating Integers

OOPS

Static memory allocation
Dynamic memory allocation
1D array and 2D array heap memory
Constructor
Destructor
Encapsulation
Inheritance
Types of inheritance
Polymorphism
Abstraction
const keyword
mutable keyword
Initialization list
Macros
Shallow copy vs deep copy
local and global variables
Static keyword in class
Abstraction deep
Inline function
friend keyword
private constructor
Virtual constructor vs virtual destructor

LinkedList

Single LinkedList structure
find length of linkedlist
Insert at head
Insert at tail
Insert at position
Delete node at postion
Reverse Linked list using loops
Reverse linked list using recursion
find middle of Linked list
K group reverse Linked list
LL circular detection and deleting loop
LL is palindrome of not
Remove duplicates from sorted LL
Remove duplicates from unsorted LL
Sort 0's 1's and 2's in LL
Add two numbers represented by LL

Doubly LinkedList

Doubly linked list structure
print doubly linked list
length of doubly linked list
Insert at head
Insert at tail
Insert at position
Delete node from position

Practice Questions of LL

Merge 2 Sorted Linked List
Clone a Linked List with Random Pointer
Merge Sort in Linked list
Flatten a Linked List
Print kth node from end of Linked List
Intersection point of 2 Linked list
Rotate List (Leetcode)
Delete n nodes after m nodes (Leetcode)
Find min/max number between critical points (Leetcode)
Merge Node in between zeroes (Leetcode)

Stack

Stack operations
Custom stack implementation (without using STL)
Create 2 stack in one array
reverse string using stack
find middle element in stack
Insert at bottom of stack
reverse a stack using only one stack
Valid parenthesis
Sort a stack
Remove redundant brackets
Min stack (stack containg the minimum element in it)
longest valid parantheses
Next smaller element
Prev Smaller element
Largest rectangular area in histogram

Practice Questions of Stack

Minimum Bracket Reversal
Remove All Adjacent Duplicates In String
Celebrity Problem
Next greater element in Linked List leetcode
N Stacks in an Array
Online Stock Span Leetcode
Check If Word Is Valid After Substitutions Leetcode
Decode Strings Leetcode
Car Fleet - I Leetcode
Car Fleet - 11 Leetcode
Simplify Path Leetcode
Max rectangle in Binary Matrix with all Is
Trapping rain Water

Queue

operations
custom implementation of Queue
Circular Queue
Input restricted Queue
Output restricted Queue
Doubly ended Queue(Deque)
Circular Doubly ended Queue
STL Deque
Reverse a queue
Reverse first k element of queue
Interleave first and second half of Queue
First -ve integer in every window of size k(sliding window + Queue)
Non-repeated character in a string
Gas Station
Sliding window maximum(sliding window + Queue)

Practice Questions of Queue

Implement Queue using stack
Implement Stack using Queue
Implement k Queue in an array

Tree

Types of tree
Terms of tree
Tree traversal
Building tree
Level order Traversal
Inorder Traversal
Preorder Traversal
PostOrder Traversal
Maximum depth / height of binary tree
Maximum depth / height of N-ary tree
Diameter of tree
Check if two tree are identical or not
Check if two trees are mirror images of each other or not
Check if binary tree is balanced binary tree
Check whether BT is sum tree or not/ convert BST into sum tree
Lowest common ancestor
Kth ancestor
Path sum
Path sum II
Sum of longest bloodline
Build tree from inorder and preorder traversal
Top View of binary tree
Bottom view of binary Tree
left view of tree
right view of tree
boundary view of tree

Practice Questions of Tree

Fast way to find diameter of tree
Fast way to determing that binary tree is balanced or not
Check 2 trees are identical or not
Check 2 trees are mirror of each other or not
Diagonal traversal of a binary tree
Zig-Zag traversal of a binary tree
Transform to Sum tree.
Vertical traversal of a binary tree.
Morris traversal of a binary tree
Sum of longest bloodline of a tree
K-sum path in a binary tree
Max sum of non-adjacent nodes in binary tree
Max time to burn a binary tree
Flatten a Binary tree into Linked List
Check if a Binary Tree contains duplicate subtrees of size 2 or more
Check for Children Sum Property in a Binary Tree
Serialize and Deserialize Binary Tree

BST

BST creation
Searching in BST
Minimum and Maximum value in BST
Inorder predeccessor/successor
Deletion in BST
Validate BST
Lowest Common Ancestor
Kth smallest Element in a BST
Create BST from Inorder Traversal
Convert a BST into balanced BST
2 sum in BST
Convert BST into sorted doubly linked list
Sorted doubly LL into BST
Convert sorted List to BST
Find largest BST in binary tree
Merge 2 BST

Practice Questions of BST

Find inorder successor and inorder predecessor in a BST
Construct BST from preorder traversal
Count pairs from 2 BST whose sum is eqaul to given value 'X'
Convert a normal BST into balanced BST
Find the median of BST in O(n) time and O(1) space
Check whether BST contains Dead end
Flatten BST to sorted list
Count BST nodes that lie in a given range
Replace every element with least greater element on its right.
Valid BST from preorder

Heap

Heap
Max heap
Insertion in max Heap
Deletion in max heap
Heapify
Heap Sort
stl heap
kth smallest number in array
merge 2 max heap
find if complete binary tree is heap or not
convert bst into max heap
check given tree is CBT
merge k sorted array
merge k sorted LL
smallest range covering element from k lists
remove stones to minimize the total
make heap and heapify stl
reorganize string
longest happy string
find median from data stream

Practice questions of heap

Check if tree is a heap
Merge 2 max heaps
K closest point to origin
Sliding window maximum
Get biggest three rhombus sums in a grid
Min diff in sum after element removal
Min number of refuelling stops

Maps and Tries

HashMap
HashMap stl
Implementation
Custom hashMap implementation
Using bucket array
Good hash function
Find freq of characters in string
Check circular LL
Tries
Trie structure
Longest common prefix
Implement dictornary

Practice question for Map & Tries

Custom Sort String (using HashMap in class level)
Array subste of another array
Union of two linked list
Intersection of two linked list
Sum equal to sum
Largest subarray with 0 sum
Implement trie prefix tree
Replace words
Top K frequent words
Camelcase matching Palindrome pairs

DP

Approach
When to apply DP
Top down (Memoization)
Bottom Up (Tabulation)
Space Optimization
1D DP and 2D DP
Fibonacci
Coin change
House robber
Painting Fence
0/1 knapsack problem - 2D DP problem
Out of Boundary Paths - 3D DP problem
Partition equal subset sum
Number of dice roll with target
Minimum swaps to make sequence increasing
Guess number higher or lower II
Minimum cost tree leaf values
Unique binary search tree
DP on string
Find longes increasing subsequence
DP with binary search
Russian Doll envelopes
Maximum Height by stacking cuboids

Practice question of DP

Linear DP

DP on Strings

DP on Trees

DP on Intervals

LIS / LCS Variants

Buy & Sell Stocks Variants [all 5 variants] Leetcode

Knapsack DP

MinMax DPs

Graph

Greedy

Arrival time of train
Lollipop
DEFKIN Min cost of ropes
Huffman encoding
Fractional knapsack
Chocolate Distribution

Sliding Window

Fixed size window
Varaible size window
Two pointer approach
Optimized window
Smallest window in a string containing all the characters of another string

Bit Manipulation

Odd/even checking
Bit masking
Change ith bit
Single number XOR logic duplication
Clear last ith bits
Check power of 2
Count set bits
Fast exponential
Clear range of bits
subsequence using bit masking

Placment Guidance

Interview Dos and Don'ts
Placement opportunities
Resume Review

LICENSE

MIT LICENSE