Skip to content

kundan-2508/Interview-Prep

Repository files navigation

Question List

Binary Search

  1. Binary search implementation (Iterative/Recursive Approach)
  2. First and last occurance
  3. Peak element in mountain array
  4. Find pivot element in sorted rotated array
  5. Find pivot element in sorted rotated array (Duplicate version)
  6. Search in sorted rotated array
  7. Sqrt using Binary search
  8. Book allocation problem
  9. Painter's partition problem
  10. Aggresive cows problem
  11. Find bitonic point in an array

Sorting

  1. Bubble sort (Iterative/Recursive Approach)
  2. Selection sort (Iterative/Recursive Approach)
  3. Insertion sort (Iterative/Recursive Approach)
  4. Merge sort (Recursive Approach)
  5. Count inversion
  6. Heap sort

Recursion

  1. Factorial
  2. Power function (a^b)
  3. Clibing stairs
  4. Fibonacci
  5. Sum of array elements
  6. Linear search
  7. Reverse a string
  8. Check palindrome
  9. Power set
  10. Subsequences of a string
  11. Reverse an array

Arrays

  1. Swap alternate
  2. Array Intersection
  3. Pair sum
  4. Count pair sum
  5. Triplet sum
  6. Sort 0's and 1's
  7. Sort 0's , 1's and 2's
  8. Maximum and minimum no in an array
  9. Unique no of occurances
  10. Merge 2 sorted arrays
  11. Move zeroes
  12. Rotate array
  13. Check for sorted array
  14. Add arrays
  15. Reverse elements in group
  16. First missing positive
  17. Trapping rain water

Matrix

  1. Wave print
  2. Spiral print
  3. Rotate matrix by 90 degree
  4. Binary search in matrix - I
  5. Binary search in matrix - II

Linked List

  1. Traversal of linked list
  2. Insert node at Head
  3. Insert node at tail
  4. Insert at any position
  5. Delete from any position
  6. Traversal of doubly linked list
  7. Insertion at any position in doubly linked list
  8. Deletion at any position in doubly linked list
  9. Circular linked list traversal
  10. Insertion in circular linked list
  11. Check linked list is circular
  12. Deletion in circular linked list
  13. Reverse a linked list (Singly & Doubly)
  14. Find middle of linked list
  15. Palindrome linked list
  16. Add 2 numbers represented by linked list
  17. Add 1 to a linked list
  18. Clone a linked list using random pointer
  19. Reverse a list in k group
  20. Detect and remove loop in linked list
  21. Remove duplicates in sorted/unsorted linked list
  22. Sort 0's , 1's and 2's
  23. Merge 2 sorted linked list
  24. Merge sort in linked list
  25. Flattening a linked list
  26. Rotate a linked list
  27. Delete last occurance of an element from linked list
  28. Delete the elements in linked list whose sum is zero
  29. Intersection of linked list
  30. Partition in linked list
  31. Nth node from end in linked list
  32. Convert sorted linked list into binary search tree
  33. Reorder linked list
  34. Find merge point of 2 linked list

Stack And Queues

  1. Stack implementation
  2. 2 stack in an array
  3. Delete middle element in stack
  4. Insert at bottom of stack
  5. Reverse stack
  6. Sort a stack
  7. Balanced brackets
  8. Reduntant bracket
  9. Minimum cost to make an expression valid

Pattern Printing

Dynamic Programing

  1. Longest Inreasing subsequence
  2. Edit distance
  3. 0/1 knapsack
  4. Subset sum
  5. Equal partition
  6. Count of subset sum
  7. Unbounded knapsack 8.Rod cutting
  8. Coin change

Graph

  1. DFS traversal
  2. BFS traversal
  3. Detect cycle in undirected graph using BFS
  4. Detect cycle in undirected graph using DFS
  5. Detect cycle in directed graph using BFS
  6. Detect cycle in directed graph using DFS
  7. Topological sorting
  8. Topological sorting using kahn's algorithm
  9. Shortest path in undirected graph
  10. Shortest path in directed graph

Tree

  1. Level order traversal
  2. Inorder traversal
  3. Pre order traversal
  4. Post order traversal
  5. Count leaf nodes
  6. Height of binary tree
  7. Diameter of binary tree
  8. Check for balanced tree
  9. Top view
  10. Bottom view
  11. Left/Right view
  12. Vertical order traversal
  13. Zig Zag traversal
  14. Check for BST

Binary Search Tree

Heaps

  1. Build Min/Max heap
  2. Insertion/Deletion in heap
  3. Heap sort
  4. Kth largest/smallest element in an array
  5. Is binary tree a heap

Trie

Backtracking

  1. Rate in a maze
  2. N queen problem

Bit Manipulation

  1. Count set bits
  2. Count bits in a number
  3. Binary to decimal
  4. Decimal to binary
  5. Power of 2
  6. Compliment of decimal
  7. Find unique
  8. Find duplicate in an array
  9. Find 2 non repeating elements in an array
  10. Find position of only set bit in a number
  11. Count number of bits to be flipped to convert A to B
  12. Copy set bits in range

Strings

  1. Check palindrome
  2. Reverse a string
  3. Valid palindrome
  4. Reverse words
  5. Maximum occurring character
  6. Remove all occurrences of substring
  7. Remove all adjacent duplicates
  8. String Compression
  9. Permutation in string

Maths

  1. Reverse a number
  2. GCD and LCM
  3. Modular concept
  4. Sieve Prime concepts
  5. Euler totient theorem
  6. Chinese remainder theorem
  7. Trailing zeroes in factorial