Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions backtracking/top questions in backtracking
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
• Backtracking Set 1 The Knights Tour Problem

• Backtracking Set 2 Rat In A Maze

• Backtracking Set 7 Suduku

• Remove Invalid Parentheses

• Word Break Problem Using Backtracking

• Print Palindromic Partitions String

• Find Shortest Safe Route In A Path With Landmines

• Combinational Sum

• Partition Set K Subsets Equal Sum

• Longest Possible Route In A Matrix With Hurdles

• Backtracking Set 8 Solving Cryptarithmetic Puzzles

• Match A Pattern And String Without Using Regular Expressions

• Find If There Is A Path Of More Than K Length From A Source

• Backtracking Set 7 Hamiltonian Cycle

• Tug Of War

• Find Maximum Number Possible By Doing At Most K Swaps

• Find Paths From Corner Cell To Middle Cell In Maze

• Arithmetic Expressions

• Crossword Puzzle

55 changes: 55 additions & 0 deletions dp/Top Questions for DP
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
Ugly Numbers
• Super Ugly Number Number Whose Prime Factors Given Set
• Maximum Size Sub Matrix With All 1S In A Binary Matrix
• Dynamic Programming Subset Sum Problem
• Minimum Number Of Jumps To Reach End Of A Given Array
• Dynamic Programming Set 15 Longest Bitonic Subsequence
• Maximum Sum Bi Tonic Sub Sequence
• Lcs Longest Common Subsequence Three Strings
• Friends Pairing Problem
• Dynamic Programming Building Bridges
• Dynamic Programming Set 18 Partition Problem
• Count Number Of Ways To Partition A Set Into K Subsets
• Dynamic Programming Set 12 Longest Palindromic Subsequence
• Dynamic Programming Set 11 Egg Dropping Puzzle
• Dynamic Programming Set 21 Box Stacking Problem
• Dynamic Programming Set 24 Optimal Binary Search Tree
• Dynamic Programming Set 28 Minimum Insertions To Form A Palindrome
• Dynamic Programming Set 36 Cut A Rope To Maximize Product
• Dynamic Programming Set 31 Optimal Strategy For A Game
• Dynamic Programming Set 32 Word Break Problem
• Mobile Numeric Keypad Problem
• Find Number Of Solutions Of A Linear Equation Of N Variables
• Count Number Ways Tile Floor Size N X M Using 1 X M Size Tiles
• Count Number Binary Strings Without Consecutive 1S
• Painters Partition Problem
• Check Whether A Given String Is An Interleaving Of Two Other Given Strings Set 2
• Wildcard Pattern Matching
• Probability Knight Remain Chessboard
• Two Water Jug Puzzle
• Dynamic Programming Set 18 Word Wrap
• Largest Sum Subarray Least K Numbers
• Find Water In A Glass
• Remove Minimum Elements Either Side 2Min Max
• Number Subsequences Form Ai Bj Ck
• Unbounded Knapsack Repetition Items Allowed
• Length Of The Longest Valid Substring
• Dynamic Programming Set 37 Boolean Parenthesization Problem
• Count Possible Decodings Given Digit Sequence
• Perfect Sum Problem Print Subsets Given Sum
• Vertex Cover Problem Set 2 Dynamic Programming Solution Tree
• Longest Even Length Substring Sum First Second Half
• Count Possible Ways To Construct Buildings
• Bitmasking And Dynamic Programming Set 1 Count Ways To Assign Unique Cap To Every Person
• Longest Repeating Subsequence
• Longest Common Increasing Subsequence Lcs Lis
• Find If String Is K Palindrome Or Not
• Minimum Sum Path 3 D Array
• Count Distinct Subsequences
• Shortest Uncommon Subsequence
• Temple Offerings
• Highway Billboard Problem
• Maximum Sum Alternating Subsequence Sum
• Minimum Maximum Values Expression
• Minimum And Maximum Values Of An Expression With * And +
32 changes: 32 additions & 0 deletions linkedLists/Top Question for Linked List
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Given Only A Pointer To A Node To Be Deleted In A Singly Linked List How Do You Delete It
• Find First Non Repeating Character Stream Characters
• Nth Node From The End Of A Linked List
• Detect And Remove Loop In A Linked List
• Write A Function To Get The Intersection Point Of Two Linked Lists
• Remove Duplicates From An Unsorted Linked List
• Merge Sort For Linked List
• Delete Nodes Which Have A Greater Value On Right Side
• Segregate Even And Odd Elements In A Linked List
• Sum Of Two Linked Lists
• Find A Triplet From Three Linked Lists With Sum Equal To A Given Number
• Flattening A Linked List
• Sort A Linked List Of 0S 1S Or 2S
• Flatten A Linked List With Next And Child Pointers
• Quicksort On Singly Linked List
• A Linked List With Next And Arbit Pointer
• Point To Next Higher Value Node In A Linked List With An Arbitrary Pointer
• Rearrange A Given Linked List In Place
• Select A Random Node From A Singly Linked List
• Linked List In Zig Zag Fashion
• Sort Linked List Already Sorted Absolute Values
• Merge K Sorted Linked Lists
• Flatten A Multi Level Linked List Set 2 Depth Wise
• Subtract Two Numbers Represented As Linked Lists
• Find Pair Given Sum Sorted Singly Linked Without Extra Space
• Multiply Two Numbers Represented Linked Lists
• Merge Two Sorted Lists Place
• Rotate Linked List Block Wise
• Josephus Circle Using Circular Linked List
• Count Triplets Sorted Doubly Linked List Whose Sum Equal Given Value X
• Sort Biotonic Doubly Linked List
19 changes: 19 additions & 0 deletions maths/Important mathematics questions for CP
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
• Euclidean algorithms (Basic and Extended)

• Prime Factorization using Sieve O(log n) for multiple queries

• Fermat’s Last Theorem

• Matrix Exponentiation

• Chinese Remainder Theorem

• Birthday Paradox

• Program for nth Catalan Number

• Pollard’s Rho Algorithm for Prime Factorization

• Euler’s Totient Function

• Sieve of Eratosthenes in 0(n) time complexity
103 changes: 103 additions & 0 deletions trees/Top Question for Trees
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# GENERIC TREES

• Check Mirror N Ary Tree
• Serialize Deserialize N Ary Tree
• Immediate Smaller Element N Ary Tree
• Second Largest Element N Ary Tree
• Node Maximum Sum Immediate Children N Ary Tree
• Given N Ary Tree Count Number Nodes Number Children Parent
• Construct Full K Ary Tree Preorder Traversal
• Creating Tree Left Child Right Sibling Representation
• Left Child Right Sibling Representation Tree
• Longest Path Undirected Tree
• Amazon Interview Question for Software Engineer in Tests
• Diameter N Ary Tree

# BINARY TREES

• Clone Binary Tree Random Pointers
• Count Subtress Sum Given Value X
• Inorder Tree Traversal Without Recursion
• Inorder Tree Traversal Without Recursion And Without Stack
• Morris Traversal For Preorder
• Iterative Postorder Traversal
• Diagonal Traversal Of Binary Tree
• Print Binary Tree Vertical Order
• Boundary Traversal Of Binary Tree
• Perfect Binary Tree Specific Level Order Traversal
• Construct A Special Tree From Given Preorder Traversal
• Construct Tree From Ancestor Matrix
• Construct Ancestor Matrix From A Given Binary Tree
• Construct A Binary Tree From Parent Array Representation
• Create Doubly Linked List Ternary Ree
• In Place Convert A Given Binary Tree To Doubly Linked List
• Convert A Given Tree To Sum Tree
• Change A Binary Tree So That Every Node Stores Sum Of All Nodes In Left Subtree
• Convert A Binary Tree To A Circular Doubly Link List
• Convert Tree Forest Even Nodes
• Lowest Common Ancestor Binary Tree Set 1
• Find Distance Between Two Nodes Of A Binary Tree
• Print Common Nodes Path Root Common Ancestors
• Root To Leaf Path Sum Equal To A Given Number
• Populate Inorder Successor For All Nodes
• Connect Nodes At Same Level With O1 Extra Space
• Connect Nodes At Same Level
• Foldable Binary Trees
• Maximum Width Of A Binary Tree
• Double Tree
• Find The Maximum Sum Path In A Binary Tree
• Vertical Sum In A Given Binary Tree
• Find Next Right Node Of A Given Key
• Deepest Left Leaf Node In A Binary Tree
• Connect Leaves Doubly Linked List
• Print Left View Binary Tree
• Custom Tree Problem
• Reverse Alternate Levels Binary Tree
• Print Nodes Distance K Given Node Binary Tree
• Find Distance Between Two Nodes Of A Binary Tree
• Diagonal Sum Binary Tree
• Tilt Binary Tree
• Find Height Binary Tree Represented Parent Array
• Remove Nodes Root Leaf Paths Length K
• Find Maximum Path Sum In A Binary Tree
• Expression Tree
• Width Binary Tree Set 1
• Reverse Tree Path
• Dynamic Programming Trees Set 2
• Serialize Deserialize Binary Tree
• Find Maximum Path Sum Two Leaves Binary Tree
• Find Height Of A Special Binary Tree Whose Leaf Nodes Are Connected

# BINARY SEARCH TREES

• Construct Bst From Given Preorder Traversa
• Binary Tree To Binary Search Tree Conversion
• In Place Convert Bst Into A Min Heap
• Construct Bst Given Level Order Traversal
• Check For Identical Bsts Without Building The Trees
• Kth Largest Element In Bst When Modification To Bst Is Not Allowed
• Kth Smallest Element In Bst Using O1 Extra Space
• Check Whether Bst Contains Dead End Not
• Merge Two Balanced Binary Search Trees
• Fix Two Swapped Nodes Of Bst
• Find If There Is A Triplet In Bst That Adds To 0
• Find A Pair With Given Sum In Bst
• Remove Bst Keys Outside The Given Range
• Add Greater Values Every Node Given Bst
• Inorder Predecessor Successor Given Key Bst
• Given N Appointments Find Conflicting Appointments
• Data Structure For Future Reservations For A Single Resource
• Count Bst Subtrees That Lie In Given Range
• Replace Every Element With The Least Greater Element On Its Right
• Find Closest Element Binary Search Tree
• Sum K Smallest Elements Bst
• Maximum Element Two Nodes Bst
• Binary Search Tree Insert Parent Pointer
• Largest Bst Binary Tree Set 2
• Leaf Nodes Preorder Binary Search Tree
• Find Median Bst Time O1 Space
• Avl Tree Set 1 Insertion
• Avl Tree Set 2 Deletion