ProDeveloperTutorial – Selected Competitive Programming Questions for Interview

===============================
Arrays Questions
===============================

  1. Arrays: Given an array of integers in ascending order, return index of the two numbers such that they add up to a specific key provided. 
  2. Arrays: Sort an array of 0s, 1s and 2s in C 
  3. Arrays: Given an array, the difference between the elements is one, find if the “key” element is present or not. 
  4. Arrays: Given an unsorted array, find the minimum difference between 2 elements. 
  5. Arrays: Given an unsorted array, find the least difference between the element pairs. Display all the pairs present. 
  6. Arrays: Given an unsorted array, and a key. Find 2 elements such that the difference between the elements is equal to the key. 
  7. Arrays: Given an unsorted integer array, find the smallest missing positive integer. 
  8. Arrays: Given an array, find all the repeated elements in C language.
  9. Arrays: Given an integer value, convert it into roman number.
  10. Arrays: Given a string, and number of rows, write the string in zigzag pattern. 
  11. Arrays: Find the Container with Most Water explanation with diagram and solution 
  12. Arrays: Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.
  13. Arrays: Given a collection of candidate numbers and a key, find all unique combinations in candidates where the candidate numbers sums to target.
  14. Arrays: Given a collection of numbers that might contain duplicates, return all possible unique permutations in C++
  15. Arrays: Merge Intervals in C++
  16. Arrays: Jump Game II in CPP
  17. Arrays: Sort Colors In Place
  18. Arrays: Given two integers n and k, return all possible combinations of k numbers out of 1 … n.
  19. Arrays: Given a set of distinct integers, nums, return all possible subsets (the power set).
  20. Arrays: Given a sorted array nums, remove the duplicates in-place such that duplicates appeared at most twice and return the new length.
  21. Arrays: Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.
  22. Arrays: Insert Interval
  23. Arrays: Given a triangle, find the minimum path sum from top to bottom.
  24. Arrays: Best time to buy sell stock
  25. Arrays: Given a non-empty array of integers, every element appears twice except for one. Find that single one.
  26. Arrays: Find the minimum element from an array that is sorted and is rotated, solution in C++
  27. Arrays: Given an array, find the majority element, solution in C++
  28. Arrays: Given the heights of histogram using an array, you need to find the largest area rectangle in that histogram. Solution in C++
  29. Arrays: You are given an unsorted array, and a key number, find the largest number of that key position.
  30. Arrays: Given an array, that has zero. Move all the zero at the end, but maintain the relative order of other elements.
  31. Arrays: Find the k’th smallest/largest element in an array
  32. Arrays: Move all the negative number in beginning
  33. Arrays: Given an array, rotate it one time
  34. Arrays: Merge Two Sorted arrays without using extra space
  35. Arrays: Find common element in 3 sorted arrays.
  36. Arrays: Rearrange the array with one positive and one negative number.
  37. Arrays: Find a triplet that sum to a given value
  38. Arrays: Find the median of 2 sorted arrays of same size
  39. Arrays: Merge sorted array inplace
  40. Arrays: Find triplet with minimum sum
  41. Arrays: Program to check if an Array is Palindrome or not
  42. Arrays: Check if 3 consecutive odds exist
  43. Arrays: Check If N and Its Double Exist
  44. Arrays: Find unique numbers that sum upto zero
  45. Arrays: Find numbers with even number of digits
  46. Arrays: Product of array except itself
  47. Arrays: Cell state after K days
  48. Arrays: Find the minimum number to an array so the sum becomes even
  49. Arrays: Given an array and a number n, rotate the array by n steps to its right.
  50. Arrays: Print in a Circular Array
  51. Arrays: Find the closest greater element for every array element from another array
  52. Arrays: Given an array, find minimum number of swaps required to sort the array
  53. Arrays: Implement prefix sum array

===============================
Strings Questions
===============================

  1. Strings: Group Anagrams in C++
  2. Strings: Wildcard Matching
  3. Strings: Simplify Path CPP
  4. Strings: Given a 2D board and a word, find if the word exists in the grid.
  5. Strings: check if the given string is valid or not explanation with solution
  6. Strings: Decode Ways
  7. Strings: Restore IP Addresses
  8. Strings: Word Ladder
  9. Strings: Given a string s, partition s such that every substring of the partition is a palindrome.
  10. Strings: Given a sentence and maxWidth. Arrange the text in such a way that each line has exactly maxWidth characters and is fully justified.
  11. Strings: You are given a sentence, reverse the string word by word
  12. Strings: Given 2 strings, check if they are isomorphic strings.
  13. Strings: You are given a string that contain a basic expression, calculate the result. Solution in C++.
  14. Strings: Reverse a string
  15. Strings: Print all the duplicates in a string
  16. Strings: Program to check if strings are rotations of each other or not
  17. Strings: Longest Repeating Subsequence
  18. Strings: Given a string, print all the subsequence
  19. Strings: Permutations of a given string
  20. Strings: Divide binary string into sub strings with equal number of 0s and 1s.
  21. Strings: Check balanced parenthesis
  22. Strings: Word Break Problem
  23. Strings: Convert a string into its mobile numeric keypad
  24. Strings: Get the minimum number of inversions needed to make an expression balanced
  25. Strings: Count the number of string in 2D character array
  26. Strings: Convert Roman Numerals to Decimal
  27. Strings: Longest Common Prefix
  28. Strings: Minimum number of flips to make binary string alternate
  29. Strings: Find the first repeated word in a string
  30. Strings: Minimum swaps required for bracket balancing
  31. Strings: Find the longest common subsequence between two strings.
  32. Strings: Check if it is possible to re-arrange characters in a string, such a way that no two adjacent are same
  33. Strings: Minimum characters to be added at beginning to make string palindrome
  34. Strings: Remove all consecutive duplicates from the string
  35. Strings: Find minimum operations required to transform a string into another string
  36. Strings: Recursively print all sentences that can be formed from list of word lists
  37. Strings: Remove all consecutive duplicates from the string
  38. Strings: Given a string convert into its equivalent ASCII form
  39. Strings: Second most repeated word in a sequence
  40. Strings: Convert Postfix to Infix
  41. Strings: Longest Prefix Suffix
  42. Strings: Calculate the basic arithmetic expression as string
  43. Strings: Calculate an expression with * and /
  44. Strings: Given an encoded string, decode string
  45. Strings: Number of Different Integers in a String
  46. Strings: Longest Substring Of All Vowels in Order
  47. Strings: Minimum Number of Swaps to Make the Binary String Alternating
  48. Strings: Longer Contiguous Segments of Ones than Zeros
  49. Strings: Check if Word Equals Summation of Two Words

===============================
BitMagic Questions
===============================

  1. Bitwise Operators: Given two integers dividend and divisor, divide two integers without using multiplication, division and mod operator.
  2. Bitwise Operators: The gray code is a binary numeral system where two successive values differ in only one bit.
  3. Bitwise Operators: Reverse Bits
  4. Bitwise Operators: Count the number of set bits
  5. Bitwise Operators: Power of 2
  6. Bitwise Operators: Missing Number
  7. Bitwise Operators: Counting set bits in a number
  8. Bitwise Operators: Hamming Distance
  9. Bitwise Operators: Bitwise and of number range
  10. Bitwise Operators: Find the two non repeating numbers.
  11. Bitwise Operators: Count number of bits to be flipped to convert A to B
  12. Bitwise Operators: Bitwise Set bit questions
  13. Bitwise Operators: Copy set bits in a range
  14. Bitwise Operators: Power Set
  15. Bitwise Operators: Given a binary number, return the 1’s and 2’s complement of that number
  16. Bitwise Operators: Add and subtract 2 numbers using bitwise operators.
  17. Bitwise Operators: Calculate the square of a number and also check if that number is even or odd using bitwise operator.
  18. Bitwise Operators: Check if the number has bits in alternate pattern and also check if the same number has equal number of set and unset bits using bitwise operators
  19. Bitwise Operators: Given 2 numbers check if one number is complement of another and also check if those two numbers are same using bitwise operators
  20. Bitwise Operators: Perform below operations using Bitwise Operators
  21. Bitwise Operators: Perform below swapping operations using Bitwise operators
  22. Bitwise Operators: Add 1 to a given number
  23. Bitwise Operators: Toggle all even bits of a number
  24. Bitwise Operators: Given a number “n”, calculate xor of 1 to n
  25. Bitwise Operators: Given a binary string, check the divisibility of the string by 2^k
  26. Bitwise Operators: Check if the given number is sparse or not
  27. Bitwise Operators: Given a number, check if all the bits of the number are set
  28. Bitwise Operators: Given a number, check if it has 2 adjacent set bits
  29. Bitwise Operators: Bitwise AND of all even number from 1 to N
  30. Bitwise Operators: Given a number, check if it is divisible by 8
  31. Bitwise Operators: Bitwise Operations Tricks

===============================
Linked List Questions
===============================

  1. Linked List: Given two non empty Linked List with non negative numbers, and numbers are stored in reverse order having single digit. Add the two list and return the result as a linked list. 
  2. Linked List: Swap Nodes in Pairs solution in C
  3. Linked List: Merge k sorted linked lists and return it as one sorted list in C++
  4. Linked List: Reverse Linked List iterative and recursive in C++
  5. Linked List: Intersection of Two Linked Lists in c++
  6. Linked List: Rotate linked list by k nodes
  7. Linked List: Remove Duplicates from Sorted List solution in CPP
  8. Linked List: Reverse a linked list from position m to n. Do it in one-pass.
  9. Linked List: Given a linked list, determine if it has a cycle in it.
  10. Linked List: Sort a linked list using insertion sort.
  11. Linked List: Given a linked list, check if it is a palindrome or not. Solution in C++
  12. Linked List: Reverse Linked List in groups
  13. Linked List: Move last element to front of a given Linked List
  14. Linked List: Add 1 to the linked list
  15. Linked List: Find middle element in Linked List
  16. Linked List: Split circular Linked List into two halves
  17. Linked List: Program to Check if a Singly Linked List is Palindrome
  18. Linked List: Deletion from a Circular Linked List
  19. Linked List: Reverse a Doubly Linked List
  20. Linked List: Find pairs with a given sum in a DLL.
  21. Linked List: Count triplets in a sorted DLL whose sum is equal to given value “k”.
  22. Linked List: Sort a “k”sorted Doubly Linked list
  23. Linked List: Rotate Doubly linked list by N nodes
  24. Linked List: Flatten a Linked List
  25. Linked List: Multiply two numbers represented by Linked Lists
  26. Linked List: Delete nodes which have a greater value on right side using recursion
  27. Linked List: Odd Even Linked List
  28. Linked List: Perform binary search on a singly linked list
  29. Linked List: Perform bubble sort on singly linked list
  30. Linked List: Perform below operations on Circular Singly Linked List:
  31. Linked List: Perform below delete operations from single linked list.
  32. Linked List: Perform below delete operations from single linked list.
  33. Linked List: Perform below operations from a circular linked list
  34. Linked List: Given a linked list convert into peak list
  35. Linked List: Perform bubble sort on Double linked list
  36. Linked List: Check if a doubly linked list of characters is palindrome or not
  37. Linked List: Perform the below delete operations on a Doubly Linked List
  38. Linked List: Sort a nearly sorted doubly linked list
  39. Linked List: Split a circular linked list into two halves
  40. Linked List: Copy a linked list with given next and random pointer
  41. Linked List: Given 2 linked list by choosing max element at each position
  42. Linked List: Given a binary tree, convert into circular doubly linked list
  43. Linked List: Convert a single linked list to circular linked list
  44. Linked List: Count the number of rotations in sorted and rotated linked list
  45. Linked List: Sort a linked list of 0, 1, 2
  46. Linked List: Given a circular linked list, exchange first and last node
  47. Linked List: Find 3 nodes whose sum equal to a given number
  48. Linked List: Given a LL, find the kth node from middle towards the head
  49. Linked List: Given 2 LL, find the first common element
  50. Linked List: Insert node into the middle of the linked list
  51. Linked List: Given Linked list and a value K, partition the list

===============================
Stack Questions
===============================

  1. Stack: Given an expression in reverse polish notation, evaluate it and get the output in C++
  2. Stack: Delete the middle element from the stack.
  3. Stack: Check for balanced brackets using stack
  4. Stack: Next Greater Element
  5. Stack: Evaluate postfix expression
  6. Stack: Insert at the end of stack
  7. Stack: Reverse a stack using recursion
  8. Stack: Sort a stack
  9. Stack: Largest Rectangular Area in a Histogram
  10. Stack: Length of the longest valid substring
  11. Stack: Expression contains redundant bracket or not
  12. Stack: Reverse the first “K” elements of a queue
  13. Stack: Next Smaller Element
  14. Stack: Remove All Adjacent Duplicates In String
  15. Stack: Build an Array With Stack Operations
  16. Stack: Make digit minimum by removing k digits.
  17. Stacks: Minimum Insertions to Balance a Parentheses String
  18. Stacks: Check if the given pattern exist in the array
  19. Stack: Score of Parentheses
  20. Stacks: Validate stack operations
  21. Stack: Convert Infix to Postfix Expression
  22. Stack: Postfix and prefix conversion
  23. Stack: Prefix to infix conversion
  24. Stack: Prefix to postfix conversion
  25. Stack: Nearest smaller numbers on left side in an array
  26. Stack: Given an array, you need to find the previous greater element
  27. Stack: Print Bracket Number
  28. Stack: Reversing the first K elements of a Queue
  29. Stack: Check if stack elements are pairwise consecutive
  30. Stack: Check if the expression contains redundant bracket or not
  31. Stack: Check if an array is stack sortable
  32. Stack: Check if valid parentheses in an expression
  33. Stack: Given a string expression, check if it is balanced expression
  34. Stack: Stock Span Problem
  35. Stack: Delete consecutive same words in a sequence
  36. Stack: Given an expression, get the minimum bracket reversal to make the expression balanced

 

===============================
Searching and Sorting Questions
===============================

  1. Searching and Sorting: Maximum and minimum of an array using minimum number of comparisons
  2. Searching and Sorting: Search an array where adjacent differ by at most k
  3. Searching and Sorting: Count all distinct pairs with difference equal to k
  4. Searching and Sorting: Maximum sum such that no two elements are adjacent
  5. Searching and Sorting: Merge 2 sorted arrays
  6. Searching and Sorting: print all subarrays with 0 sum
  7. Searching and Sorting: Product of array except itself.
  8. Searching and Sorting: Minimum number of swaps required to sort an array
  9. Searching and Sorting: K-th Element of Two Sorted Arrays
  10. Searching and Sorting: Find the missing number in Arithmetic Progression
  11. Searching and Sorting: Find the majority element in the array
  12. Searching: Find all the triplets with zero sum
  13. Searching: Check if all occurrence if a character appear together
  14. Searching: Check if there exist 2 elements in an array whose sum is equal to the sum of rest of the array
  15. Searching: Count the number of 1s in a sorted binary array
  16. Searching: Count number of occurrence in a sorted array
  17. Searching: Find median of two sorted array of different sizes
  18. Searching: Allocate minimum pages
  19. Searching: Find fixed point in the given array
  20. Searching: Given an number, find the numbers whose factorials end with n zeros
  21. Searching: Find the closest number in the sorted array
  22. Searching: Given a string and a key, find the smallest letter that is greater than the key
  23. Searching: Given an sorted rotated array, find the given key is present
  24. Searching: Find index of an extra element in a sorted array
  25. Searching: Given an array, find the largest pair sum
  26. Searching: Find the k maximum elements of an array in original array.
  27. Searching: Aggressive Cows
  28. Searching: Find the missing elements of 2 sorted arrays
  29. Searching: Find the missing number

===============================
Sorting Questions
===============================

  1. Sorting: Given an array, sort the elements alternatively
  2. Sorting: Get union of 2 sorted arrays
  3. Sorting: Given an array, return the number of steps required to make array elements same
  4. Sorting: Given an array, count inversions
  5. Sorting: Given 2 arrays, return minimum number of platforms required for a railway station
  6. Sorting: Minimum increment to make array unique
  7. Sorting: Merge 2 sorted arrays
  8. Sorting: Check if any interval completely overlaps other
  9. Sorting: Given an array, you need to check if it has contiguous integers
  10. Sorting: Given an array, minimize sum of product of consecutive pairs
  11. Sorting: Check if reversing sub array make the array sorted
  12. Sorting: Check if two arrays are equal or not
  13. Sorting: Check if the array is Arithmetic Progression
  14. Sorting: Check if a given array is K sorted or not
  15. Sorting: Check if the array can be fit into another array by re-arranging the elements.
  16. Sorting: Given an unsorted array and a value x, you need to check if a pair exist for given difference
  17. Sorting: Merge two sorted arrays without extra space.
  18. Sorting: Given a string, sort it by frequency of characters
  19. Sorting: Get the intersection of 2 arrays
  20. Sorting: Sort an array having partially sorted and partially unsorted array
  21. Sorting: Given an array, you need to remove the elements to make the array as sorted.
  22. Sorting: Find minimum difference between any two elements in a array
  23. Sorting: Print elements occurred only once in the array
  24. Sorting: Find the missing element of a range in an array
  25. Sorting: Find a pair with maximum product in array of integers

===============================
Binary Searching Questions
===============================

  1. Binary Search: Given an array sorted in ascending order and is rotated at some pivot, given a target value to search, if found in the array return its index
  2. Binary Search: Search a 2D Matrix in C++
  3. Binary Search: Binary search on an array that is in descending order
  4. Binary Search: Order-Agnostic Binary Search
  5. Binary Search: Find the first and last occurrence of an element
  6. Binary Search: Find the number of times a Sorted array is Rotated
  7. Binary Search: Searching in a Nearly Sorted Array
  8. Binary Search: Find Floor of an element in a Sorted Array
  9. Binary Search: Find Ceil of an element in a Sorted Array
  10. Binary Search: Find position of an element in an Infinite Sorted Array
  11. Binary Search: Find the index of first 1 in an infinite sorted array of 0s and 1s
  12. Binary Search: Peak Element
  13. Binary Search: Find maximum element in Bitonic Array
  14. Binary Search: Search An Element in Bitonic Array
  15. Binary Search: Get the rotation count in sorted rotated array
  16. Binary Search: Count the number of 1’s in an array sorted in decreasing order.
  17. Binary Search: Searching and Sorting: Get the fixed point in an array

===============================
Queue Questions
===============================

  1. Queue: Given a Linked list, construct a complete binary tree
  2. Queue: Sort a queue without using extra space
  3. Queue: Reverse first K elements in the queue
  4. Queue: Implement priority queue using Linked List
  5. Queue: Find the first non repeating character in the stream
  6. Queue: Given a queue, reverse it
  7. Queue: Given a queue and element k, revert the first k element of the queue
  8. Queue: Implement dequeue using doubly linked list
  9. Queue: Implement queue using stacks
  10. Queue: Given a queue, interleave first half of the queue with second half
  11. Queue: Given a queue, check if queue can be sorted using stack
  12. Queue: Given 2 sorted arrays, you need to merge them using priority queue
  13. Queue: Reverse a stack using queue
  14. Queue: Maximum of all subarrays of size K

===============================
Matrix Matrix Questions
===============================

  1. Matrix: You are given an n x n 2D matrix rotate it by 90 degrees (clockwise) in C++.
  2. Matrix: Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.
  3. Matrix: Given a positive integer n, generate a square matrix filled with elements from 1 to n2 in spiral order in C++
  4. Matrix: Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in-place.
  5. Matrix: Search a 2D Matrix in C++
  6. Matrix: Check if the given board is valid Sudoku or not explanation with solution in CPP
  7. Matrix: Surrounded Regions
  8. Matrix: Soduku Solver
  9. Matrix: Given a 2d matrix, filled with 1 and 0. Find the maximum sub-matrix that has only 1’s and return the area.
  10. Matrix: Find median in a row wise sorted matrix.
  11. Matrix: Kth smallest element in a sorted matrix
  12. Matrix: Get the common elements in all row of a matrix.
  13. Matrix: Given a matrix, print the boundary elements
  14. Matrix: Given a matrix, rotate matrix 180 degree
  15. Matrix: Given a matrix, you need to find the sum of diagonals of a matrix.
  16. Matrix: Given a matrix, find the transpose of the matrix
  17. Matrix: Given a matrix, check if the matrix is sparse or not
  18. Matrix: Given a matrix, check if it is orthogonal or not
  19. Matrix: Find common elements in all rows of a given matrix
  20. Matrix: Given a matrix, count the number of sorted rows
  21. Matrix: Given a matrix, count the majority element
  22. Matrix: Given a binary matrix, find the rows with max 1s
  23. Matrix: Given a matrix, you need to count the number of rows and columns whose sum equal to diagonal sum
  24. Matrix: Given a matrix, count zero in row wise and column wise matrix
  25. Matrix: Given a 2D matrix, find the peak element.
  26. Matrix: Given a matrix, set it to zero

===============================
Recursion Questions
===============================

  1. Recursion: Count the number of ways a baby can reach the n’th stair taking 1 or 2 steps at a time in C language. 
  2. Recursion: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. 
  3. Recursion: Given a collection of distinct integers, return all possible permutations.
  4. Recursion: Implement pow(x, n), which calculates x raised to the power n (xn) in C++
  5. Recursion: Count the ways to decode a digit sequence
  6. Recursion: Get the nth Fibonacci Number
  7. Recursion: Get the least number of perfect squares
  8. Recursion: Convert a given decimal number into binary using recursion
  9. Recursion: Reverse the queue using recursion
  10. Recursion: Given two numbers, add them recursively
  11. Recursion: Power of three
  12. Recursion: Check if a number is palindrome using recursion
  13. Recursion: Print N to 1 using recursion
  14. Recursion: Print alternate node in a Linked List using recursion
  15. Recursion: Given a string and a sub-string, count the number of occurrence recursively.
  16. Recursion: Given a number, count the number of ways to express a number as sum of powers.
  17. Recursion: Given a decimal number, convert into binary number using recursion
  18. Recursion: Given a stack, delete the middle element using recursion
  19. Recursion: You are given a stack, reverse it using recursion
  20. Recursion: Given a linked list, find the middle element recursively
  21. Recursion: Given a number, generate all binary strings.
  22. Recursion: Given a string, find the occurrence of first uppercase letter in the string.
  23. Recursion: Remove adjacent duplicates in the string.
  24. Recursion: Given an array, generate all sub arrays using recursion
  25. Recursion: Remove K adjacent duplicate in a string
  26. Recursion: Handshake problem

===============================
Heaps Questions
===============================

  1. Heaps Introduction
  2. Heap: Heap Sort
  3. Heap: Max Heap and Min heap using Priority Queue
  4. Heaps: Build Min Heap from an Array
  5. Heaps: Sort an Array using heap
  6. Heaps: Find kth smallest in an unsorted array
  7. Heaps: Merge “K” sorted arrays
  8. Heap: Kth smallest element.
  9. Heap: Return k largest element
  10. Heap: Sort a K sorted array or nearly sorted array
  11. Heap: K closest number
  12. Heap: Top K Frequent Elements
  13. Heap: Top K Frequent Words
  14. Heap: Sum of all the elements between k1 and k2 smallest elements
  15. Heap: kth largest element in a stream
  16. Heap: Given two max heaps, merge them
  17. Heap: Find median in a stream
  18. Heap: Check if given a binary tree is a Heap
  19. Heap: k closest number
  20. Heap: Convert Min Heap to Max Heap
  21. Heap: Given an array, sort the array using min heap
  22. Heap: Given an array, check if the array represents Binary Max Heap
  23. Heap: kth largest in a stream
  24. Heap: K Closest Points To Origin
  25. Heap: Find the minimum product of k integers in an array
  26. Heap: Given an array, find the kth largest element in the array
  27. Heap: Given an array, find the top K frequency elements
  28. Heap: Given an array, find the kth smallest pair sum

===============================
Hashing Questions
===============================

  1. Hashing: Given an array of integers in ascending order, return index of the two numbers such that they add up to a specific key provided. 
  2. Hashing: You are given an array, you need to return kth distinct element
  3. Hashing: Longest consecutive sequence
  4. Hashing: Given an array, check if the array is a permutation of numbers from 1 to N.
  5. Hashing: Given a array, you need to find a duplicate within k distance in the array.
  6. Hashing: Given a string, check if it is isogram or not
  7. Hashing: Given an array, find two non overlapping pairs having equal sum
  8. Hashing: Given 2 strings, find uncommon characters
  9. Hashing: Replace all the elements of the array by its rank in the array
  10. Hashing: Given a sorted array, count the absolute distinct count
  11. Hashing: Given 2 arrays, check if they are equal or not
  12. Hashing: Given two arrays, sort first array according to the order of second array
  13. Hashing: Find the first repeating element and index in the array
  14. Hashing: Given an array, find the first missing positive number
  15. Hashing: Given an array, find the majority element
  16. Hashing: Given an array, find the element that occurs odd number of times
  17. Hashing: Given 2 arrays, and a value x, you need to find the pairs sum equal to the given value of x.
  18. Hashing: Given an array and a value k, return top k frequent elements
  19. Hashing: Given an array, you need to find the missing number
  20. Hashing: Given an array, count all the subsets with even numbers and are distinct
  21. Hashing: Given an array, you need to count the frequency if the array elements

===============================
Dynamic Programming Questions
===============================

  1. Dynamic Programming: Longest Palindromic Substring In C++ 
  2. Dynamic Programming: Given an input string (s) and a pattern (p), implement regular expression matching with support for ‘.’ and ‘*’. 
  3. Dynamic Programming: Rain water trapping
  4. Dynamic Programming: Unique Paths Solution in CPP
  5. Dynamic Programming: Unique Paths 2
  6. Dynamic Programming: Minimum Path Sum in CPP
  7. Dynamic Programming: Longest Increasing Subsequence
  8. Dynamic Programming: Longest Bitonic Subsequence
  9. Dynamic Programming: Get Max Coin In Game problem.
  10. Dynamic Programming: Rod Cutting Problem
  11. Dynamic Programming: Box Stacking Problem
  12. Dynamic Programming: Building Bridges
  13. Dynamic Programming: Egg Dropping Problem
  14. Dynamic Programming: Min Edit Distance
  15. Dynamic Programming: 0 1 Knapsack Problem using Dynamic Programming
  16. Dynamic Programming: Binomial Coefficiet Problem
  17. Dynamic Programming: Permutation Coefficient
  18. Dynamic Programming: Get the nth catalan number
  19. Dynamic Programming: Subset sum problem
  20. Dynamic Programming: Unbounded Knapsack Problem
  21. Dynamic Programming: Equal Sum partition
  22. Dynamic Programming: Climb the stairs with minimum cost
  23. Dynamic Programming: Robbing Houses
  24. Dynamic Programming: Get the sum by deleting elements from the array
  25. Dynamic Programming: Count of subset sum with a given sum
  26. Dynamic Programming: Minimum subset difference
  27. Dynamic Programming: Target Sum
  28. Dynamic Programming: Count the number of subset with a given difference
  29. Dynamic Programming: Minimum Number of swaps to make array increasing
  30. Dynamic Programming: Longest Common Subsequence
  31. Dynamic Programming: Print Longest Common Sub-sequence
  32. Dynamic Programming: Length of Shortest Common Supersequence
  33. Dynamic Programming: Print Shortest Common Supersequence
  34. Dynamic Programming: Minimum number of deletions and insertions to convert one string into another
  35. Dynamic Programming: Longest repeating subsequence
  36. Dynamic Programming: Check if one string is a subsequence of another
  37. Dynamic Programming: Count how many times string 1 appears as substring in string 2.
  38. Dynamic Programming: Longest Common Substring
  39. Dynamic Programming: Get the count of delete operations on 2 strings.
  40. Dynamic Programming: Find the Maximum and minimum of an array

===============================
Divide and conquer Questions
===============================

  1. Divide and Conquer: Implement pow(x, n), which calculates x raised to the power n (xn) in C++

===============================
Backtracking Questions
===============================

  1. Backtracking: Given an array of non repeating numbers and a key, find all the unique combinations in that array, where the sum of those combination is equal to the key.
  2. Backtracking: Letter Combinations of a Phone Number
  3. Backtracking: The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.
  4. Backtracking: Subsets II in CPP
  5. Backtracking: Partition string into its palindrome
  6. Backtracking: You are given an array with repeated elements and a key element, find all unique combination to the key
  7. Backtracking: Get the k combination from an array of 1 to n
  8. Backtracking: Find combination sum of k numbers that sum up to n
  9. Backtracking: Letter case permutation
  10. Backtracking: Get the sequential digits from the given range
  11. Backtracking: Return the number of queens possible in a chessboard
  12. Backtracking: Partition to K Equal Sum Subsets
  13. Backtracking: Get maximum sum in a matrix

===============================
Binary Trees Questions
===============================

  1. Binary Trees: Get difference between values at Even and Odd level in a binary tree
  2. Binary Tree: Get Number of Nodes in a Binary Tree
  3. Binary Tree: Display nodes at given level in Binary Tree
  4. Binary Tree: Display Reverse Level Order Traversal by using queue
  5. Binary Tree: Perform PreOrder traversal on a Binary Tree by without Recursion
  6. Binary Tree: Perform InOrder traversal on a Binary Tree by without Recursion
  7. Binary Tree: Perform PostOrder traversal on a Binary Tree by without Recursion
  8. Binary Tree: Convert a binary tree to its Mirror Tree
  9. Binary Tree: Delete a binary tree
  10. Binary Tree: Get Level of a Given Node
  11. Binary Tree: Display elements between any two given level
  12. Binary Tree: Check if binary tree is a height balanced tree?
  13. Binary Tree: Find Parent of a given node value in Binary Tree
  14. Binary Tree: Find Sibling node of a given node value in Binary Tree
  15. Binary Tree: Get Sum of all nodes formed from Root to Leaf Path
  16. Binary Tree: Get Sum of all Leaf Nodes in Binary Tree
  17. Binary Tree: Find Maximum or Minimum in Binary Tree
  18. Binary Tree: Check if Binary Tree is Foldable Tree
  19. Binary Tree: Check if two Binary Trees are Isomorphic
  20. Binary Tree: Display all the leaf nodes from left to right and right to left in a tree
  21. Binary Tree: Get count Non-Leaf nodes in a Binary Tree
  22. Binary Tree: Get the count full nodes in a Binary
  23. Binary Tree: Bottom view of binary Tree
  24. Binary Tree: Boundary Traversal of Binary Tree
  25. Binary Tree: Top view of a binary tree
  26. Binary Tree: Left view and right view of a Binary Tree
  27. Binary Tree: Level Order Traversal
  28. Binary Tree: Vertical Order Traversal
  29. Binary Tree: Height or Max depth if a BTree
  30. Binary Tree: Spiral order or Zigzag traversal of a Binary Tree
  31. Binary Tree: Diameter of a Binary Tree
  32. Binary Tree: Lowest Common ancestor of a Binary Tree.
  33. Binary Tree: Check if 2 nodes are mirror of each other
  34. Binary Tree: Add all the node values in a Binary Tree or Sum of a Binary tree
  35. Binary Tree: Print the number of leaf nodes in a binary tree
  36. Binary Tree: Print all the paths from root node to leaf node
  37. Binary Trees: Diagonal Traversal of a Binary tree
  38. Binary Trees: Kth Ancestor of a Tree Node
  39. Binary Tree: Given a binary tree, check if the tree is perfect or not.
  40. Binary Tree: Maximum path sum in a binary tree
  41. Binary Tree: Convert BST to Min Heap
  42. Binary Tree: You are given a binary tree, you need to print the extreme nodes in alternate order.
  43. Binary Tree: Given a binary tree, find the maximum path sum between two leaves
  44. Binary Tree: Given a binary tree and a target, delete leaf nodes having value target
  45. Binary Tree: Given a binary tree and a target, burn it
  46. Binary Tree: Given a binary tree, check if the tree is a children sum property
  47. Binary Tree: Given a binary tree, check if there is duplicate subtree and return the duplicate subtree
  48. Binary Tree: Given two trees, check if the tree is subtree of another tree
  49. Binary Tree: Given a binary tree and two nodes, check if they are cousins
  50. Binary Tree: Given a binary tree, invert it

 

===============================
Graph Questions
===============================

  1. Graph: Detect a cycle in a directed graph
  2. Graph: Detect a cycle in a undirected graph
  3. Graph: Check if the given edge is a bridge in the graph
  4. Graph: Check if undirected graph is connected or not
  5. Graph: Count the number of connected components in an undirected graph
  6. Graph: Reverse a directed graph
  7. Graph: Given an directed graph, find the in and out degree of all vertices
  8. Graph: Find there is a path between 2 nodes in a directed graph
  9. Graph: Get the unique lengths of connected components of an undirected graph.
  10. Graph: Find if there is a path between 2 nodes in an undirected graph
  11. Graph: Check if a graph is a strongly connected using Kosaraju DFS algorithm
  12. Graph: Dice Sum Problem
  13. Graph: DFS graph traversal
  14. Graph: Find the number of Islands
  15. Graph: Check if the given courses can be completed with prerequisites
  16. Graph: Given a graph, check if it is bipartite or not – Using BSF
  17. Graph: Given a graph with source and destination, count all the possible path between two vertices
  18. Graph: Given a matrix, find the distance of nearest cell having 0
  19. Graph: Flood Fill algorithm
  20. Graph: Find minimum time to rot all the oranges
  21. Graph: Get all the paths from source to destination
  22. Graph: Given a matrix, replace ‘o’ with ‘x’, if surrounded by ‘x’
  23. Graph: You are given a graph, clone the graph using deep copy
  24. Graph: Given a dictionary and a matrix, find all the words from the dictionary found in matrix
  25. Graph: Given a binary matrix, find the largest region of 1
  26. Graph: Given a matrix, find the number of closed islands

===============================
Binary Search Trees Questions
===============================

  1. Binary Search Trees: Deletion of a node in a BST
  2. Binary Search Trees: Find min and max value in a BST
  3. Binary Search Trees: Find the Inorder predecessor and successor for a given key in BST
  4. Binary Search Trees: A program to check if a binary tree is BST or not
  5. Binary Search Trees: Convert a BST into greater sum tree
  6. Binary Search Trees: LCA in a BST
  7. Binary Search Trees: Construct BST from preorder traversal
  8. Binary Search Trees: Convert Binary Tree into Binary Search Tree.
  9. Binary Search Trees: Convert a normal BST into a Balanced BST
  10. Binary Search Trees: Merge Two balanced BST
  11. Binary Search Trees: Kth Largest Element in a BST
  12. Binary Search Trees: Count the number of BST nodes that lie in a given range.
  13. Binary Search Trees: Find triplet sum in BST
  14. Binary Search Trees: Check if the pre-order is a valid BST
  15. Binary Search Trees: Check if the BST has a dead end
  16. Binary Search Trees: Correct a BST where 2 nodes are swapped
  17. Binary Search Tree: Unique Binary Search Trees
  18. Binary Search Trees: Check If Preorder Traversal Is Valid BST
  19. Binary Search Trees: Given an array, check if it represents inorder traversal of BST.
  20. Binary Search Trees: Given a BST, check if each internal node has only one child
  21. Binary Search Trees: Given a BST and a key, find the next smaller element of that key
  22. Binary Search Trees: Given a BST and a range, return the range sum of that BST
  23. Binary Search Trees: Given a BST, find median in BST
  24. Binary Search Trees: Given 2 BST, check if both contain same set of elements
  25. Binary Search Trees: Given a sorted array, convert into balanced bst
  26. Binary Search Trees: Given 2 BST, print common nodes in the BST

===============================
Greedy Questions
===============================

  1. Greedy: Add elements in an array so the sum is equal to the given range
  2. Greedy: Remove k digits from a number to make it a smallest integer.
  3. Greedy: Get the minimum platforms needed to avoid delay in the train arrival.
  4. Greedy: Check if the string is a substring of another string
  5. Greedy: Remove overlapping intervals.
  6. Greedy: Maximum meetings in one room
  7. Greedy: Distribute Candy
  8. Greedy: Schedule task efficiently
  9. Greedy: Shuffle array so that one array element is greater than other array element
  10. Greedy: Maximum sum of absolute difference of an array
  11. Greedy: Juice change
  12. Greedy: Perform operations on a broker calculator
  13. Greedy: Remove covered intervals.
  14. Greedy: String break problem
  15. Greedy: Connect ropes with minimum cost.
  16. Greedy: Assign maximum cookies
  17. Greedy: Non overlapping intervals
  18. Greedy: Minimum swaps to make strings equal
  19. Greedy: Insert new interval
  20. Greedy: Reorganize String
  21. Greedy: Check for Increasing triplet subsequence
  22. Greedy: Given a string, partition the string such that each letter appears at only one part
  23. Greedy: Given an array, find the longest alternative subsequence
  24. Greedy: Check if a given string becomes palindrome by deleting atmost one char
  25. Greedy: Get the maximum number by swapping once
  26. Greedy: Given a string, return the length of longest palindrome
  27. Greedy: Given a string, check if it is a valid parenthesis or not

===============================
2 pointers Questions
===============================

  1. Two Pointers: Given an array, find 3 elements such that [a + b + c] = 0. Find all the 3 unique elements. 
  2. Two Pointers: Given an array of n integers and an integer “key”, find three integers in the array such that the sum is closest to key. 
  3. Two Pointers: Given an array n integers and an integer key, are there four elements a, b, c, and d in the array such that a + b + c + d = key? Find all unique quadruplets in the array which gives the sum of key. 
  4. Two Pointers: Rain water trapping
  5. Two Pointers: Reverse an array
  6. Two Pointers: Arrays: Given an array find the duplicate number
  7. Two Pointers: Arrays: Minimum swaps required to bring all elements less than or equal to k together
  8. Two Pointers: Arrays: Get minimum number of merge operations to make an array palindrome
  9. Two Pointers: Given an array and a value “m”, choose “m” elements having minimum difference between max and min
  10. Two Pointers : Move all negative numbers to beginning and positive to end using extra space
  11. Two Pointers: Count pairs with sum less than target
  12. Two Pointers: Meeting rooms
  13. Two Pointers: Given a string with special characters, reverse only alphabets
  14. Two Pointers: Minimum boats to save people
  15. Two Pointers: Given an array, sort the array by making element squares
  16. Two Pointers: Given 2 arrays, find the common elements
  17. Two Pointers: Given a binary array, return maximum consecutive ones
  18. Two Pointers: Given a string, reverse the string by preserving whitespace.
  19. Two Pointers: Given a binary string, check if the string has most number of contiguous segment of one
  20. Two Pointers: Given an array and a value k, return the count of pairs with k difference
  21. Two Pointers: Given two arrays find the intersection of two arrays
  22. Two Pointers: Given two arrays with duplicate, you need to return the union of two arrays
  23. Two Pointers: Given an array and a value K, you need to return the size of minimum subarray that is equal to k
  24. Two Pointers: Given a array and a value k, return the number of subarray whose product is less that k
  25. Two Pointers: Celebrity Problem
  26. Two Pointers: Given an array, return the count of smallest subarray to be removed to make the remaining array sorted

===============================
Sliding Window Questions
===============================

  1. Sliding Window: Strings: Smallest distinct window
  2. Sliding Window: Strings: Minimum Window Substring
  3. Sliding Window: Given a string, get the number of substrings having ‘a’, ‘b’, ‘c’
  4. Sliding Window: Given an array and integer k, find the max sum of distinct subarray of length k
  5. Sliding Window: Given an array and size k, find the first negative integer in each window of size k
  6. Sliding Window: Given an array and a value k, find the maximum average subarray
  7. Sliding Window: Return the maximum consecutive ones after flipping k zeros
  8. Sliding Window: Return the number of sub array size k that is greater than or equal to threshold
  9. Sliding Window: Given a string a variable k, count substring with k frequency characters
  10. Sliding Window: Return he longest length of the substring with consecutive characters
  11. Sliding Window: Maximum consecutive ones by flipping K bits
  12. Sliding Window: Given an array, count maximum number of ones
  13. Sliding Window: Subarrays with k odd numbers
  14. Sliding Window: Longest substring without repeating character
  15. Sliding Window: Longest substring after character replacement
  16. Sliding Window: Return count of subarray with sum equal to k
  17. Sliding Window: Given a string you need to find the longest non repeating substring
  18. Sliding Window: Return length of longest subarray with having at most k frequency
  19. Sliding Window: Fruits into baskets
  20. Sliding Window: Maximum points you can obtain from cards
  21. Sliding Window: Subarray with k different integers
  22. Sliding Window: Smallest sum of contiguous subarray
  23. Sliding Window: Given an array and a target value, get the subarray product less than k

===============================
Merge interval pattern
===============================

  1. Merge interval pattern: Merge Overlapping Intervals
  2. Merge interval pattern: Find intersection of all intervals
  3. Merge interval pattern: Check if two intervals overlap
  4. Merge interval pattern: Check if person can attend all the meetings
  5. Merge interval pattern: Make Intervals Non Overlapping

===============================
Prefix sum problems
===============================

  1. Prefix sum problems: Given an array find Equilibrium Index
  2. Prefix sum problems: Bitwise OR of sum of all subsequence of the array
  3. Prefix sum problems: Maximum equilibrium sum in an array
  4. Prefix sum problems: Get original array from Prefix sum array
  5. Prefix sum problems: Find the largest subarray with sum 0
  6. Prefix sum problems: Longest subarray with sum k
  7. Prefix sum problems: Given an array and value k, return the count of subarray with sum k
  8. Prefix sum problems: Given bianry array and a value k, return the count of subarray sum

===============================
Kadane’s Algorithm
===============================

  1. Kadane’s Algorithm: Maximum Subarray Sum
  2. Kadane’s Algorithm: Maximum Circular Subarray Sum
  3. Kadane’s Algorithm: Maximum Product Subarray
  4. Kadane’s Algorithm: Maximum Subarray Sum after removing at most one element
  5. Kadane’s Algorithm: Maximum Sum Rectangle In A 2D Matrix
  6. Kadane’s Algorithm: Maximum Product Subarray
  7. Kadane’s Algorithm: minimum size subarray sum
  8. Kadane’s Algorithm: Largest sum increasing contiguous subarray
  9. Kadane’s Algorithm: Maximum Product Subarray