# Array

Question 1: Arrays: Find numbers with even number of digits

Question 2: Arrays: Find unique numbers that sum upto zero

Question 3: Arrays: Find the k’th smallest/largest element in an array

Question 4: Arrays: Check If N and Its Double Exist

Question 5: Arrays: Move all the negative number in beginning

Question 6: Arrays: Find the union and intersection of two sorted arrays

Question 7: Arrays: Given an array, rotate it one time

Question 9: Arrays: Minimize the maximum difference between the heights

Question 10: Arrays: Reach the end of the array with minimum jumps. Solution in C++

Question 11: Arrays: Given an array find the duplicate number

Question 12: Arrays: Merge Two Sorted arrays without using extra space

Question 13: Arrays: Kadane Algorithm

Question 14: Arrays: Merge overlapping Intervals solution in C++

Question 15: Arrays: Implement next permutation, which rearranges numbers into the next greater permutation of numbers.

Question 16: Arrays: Inversion Count in an Array

Question 17: Arrays: Optimum Time to Buy and Sell Stock

Question 19: Arrays: Find common element in 3 sorted arrays.

Question 20: Arrays: Rearrange the array with one positive and one negative number.

Question 21: Arrays: Given an array, find 3 elements such that [a + b + c] = 0. Find all the 3 unique elements.

Question 22: Arrays: Check if 3 consecutive odds exist

Question 23: Arrays: Given an integer array, find the maximum product made from continuous elements in that array.

Question 24: Arrays: Longest Increasing Subsequence

Question 25: Arrays: Given an array, find the majority element

Question 26: Arrays: Merge sorted array inplace

Question 27: Arrays: Find whether an array is subset of another array

Question 28: Arrays: Find a triplet that sum to a given value

Question 29: Arrays: Rain water trapping

Question 30: Arrays: Find triplet with minimum sum

Question 31: Arrays: Given an array of non repeating numbers and a key, find all the unique combinations in that array

Question 32: Arrays: Three way partitioning of an array around a given range

Question 33: Arrays: Minimum swaps required to bring all elements less than or equal to k together

Question 34: Arrays: Get minimum number of merge operations to make an array palindrome

Question 35: Arrays: Find the median of 2 sorted arrays of same size

Question 36: Arrays: Program to check if an Array is Palindrome or not

# Matrix

Question 1: Matrix: Given a matrix of m x n elements , print all elements of the matrix in spiral order

Question 2: Matrix: Given a 2D Matrix and a key element, search and return if element is present or not

Question 3: Matrix: Find median in a row wise sorted matrix

Question 4: Matrix: Find a row with maximum number of 1’s in a binary matrix

Question 5: Matrix: Given a m x n matrix, if an element is 0, set its entire row and column to 0

Question 7: Matrix: Find pair with maximum sum in the matrix.

Question 8: Matrix: Given an n x n 2D matrix rotate it by 90 degrees

Question 9: Matrix: Kth smallest element in a sorted matrix

Question 1o: Matrix: Get the common elements in all row of a matrix.

**Strings**

Question 1: Strings: Reverse a string

Question 2: Strings: Remove all consecutive duplicates from the string

Question 3: Strings: Print all the duplicates in a string

Question 4: Strings: Given a string convert into its equivalent ASCII form

Question 5: Strings: Program to check if strings are rotations of each other or not

Question 6: Strings: Second most repeated word in a sequence

Question 7: Strings: Minimum Number of Swaps to Make the Binary String Alternating

Question 8: Strings: Given a string find the longest Palindromic Substring

Question 9: Strings: Longer Contiguous Segments of Ones than Zeros

Question 1o: Strings: Given a string, print all the subsequence

Question 11: Strings: Permutations of a given string

Question 12: Strings: Divide binary string into sub strings with equal number of 0s and 1s.

Question 13: Strings: Given a sentence and maxWidth. Arrange the text in such a way that each line has exactly maxWidth characters

Question 14: Strings: Min Edit Distance

Question 15: Strings: Longest Substring Of All Vowels in Order

Question 16: Strings: Check balanced parenthesis

Question 17: Strings: Check if it is possible to re-arrange characters in a string, such a way that no two adjacent are same

Question 18: Strings: Rabin Karp algorithm

Question 19: Strings: Knuth Morris Pratt String matching algorithm

Question 2o: Strings: Convert a string into its mobile numeric keypad

Question 21: Strings: Get the minimum number of inversions needed to make an expression balanced

Question 22: Strings: Given a string return all the substring that is a palindrome

Question 23: Strings: Count the number of string in 2D character array

Question 24: Strings: Given 2D matrix and a word, find if the word exists in the grid

Question 25: Strings: Boyer Moore algorithm

Question 26: Strings: Convert Roman Numerals to Decimal

Question 27: Strings: Longest Common Prefix

Question 28: Strings: Minimum number of flips to make binary string alternate

Question 29: Strings: Minimum swaps required for bracket balancing

Question 3o: Strings: Find the first repeated word in a string

Question 31: Strings: Find the longest common subsequence between two strings.

Question 32: Strings: Given a string of integers, restore all valid IP addresses

Question 33: Strings: Smallest distinct window

Question 34: Strings: Check if it is possible to re-arrange characters in a string, such a way that no two adjacent are same

Question 35: Strings: Check if Word Equals Summation of Two Words

Question 36: Strings: Group Anagrams

Question 37: Strings: Minimum Window Substring

Question 38: Strings: Remove all consecutive duplicates from the string

Question 39: Strings: Wildcard Matching

Question 4o: Strings: Longest Prefix Suffix

Question 41: Strings: Find minimum operations required to transform a string into another string

Question 42: Strings: Given 2 strings, check if they are isomorphic strings

Question 43: Strings: Recursively print all sentences that can be formed from list of word lists

Question 44: Strings: Number of Different Integers in a String

# Searching & Sorting

Question 1: Searching & Sorting: Find the first and last occurrence of an element

Question 2: Searching and Sorting: Get the fixed point in an array

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

Question 6: Searching and Sorting: Binary search on an array that is in descending order

Question 7: Searching and Sorting: Order-Agnostic Binary Search

Question 8: Searching and Sorting: Find the majority element in the array

Question 9: Searching and Sorting: Search an array where adjacent differ by at most k

Question 1o: Searching and Sorting: Count all distinct pairs with difference equal to k

Question 12: Searching and Sorting: Maximum sum such that no two elements are adjacent

Question 14: Searching and Sorting: Merge 2 sorted arrays

Question 15: Searching and Sorting: print all subarrays with 0 sum

Question 16: Searching and Sorting: Product of array except itself

Question 17: Searching and Sorting: Sort Integers by The Number of 1 Bits

Question 18: Searching and Sorting: Minimum number of swaps required to sort an array

Question 19: Searching and Sorting: Find the smallest and second smallest elements in an array

Question 2o: Searching and Sorting: Find the number of times a Sorted array is Rotated

Question 21: Searching and Sorting: Searching in a Nearly Sorted Array

Question 22: Searching and Sorting: Find the minimum element from an array that is sorted and is rotated

Question 23: Searching and Sorting: K-th Element of Two Sorted Arrays

Question 24: Searching and Sorting: Find Floor of an element in a Sorted Array

Question 25: Searching and Sorting: Find Ceil of an element in a Sorted Array

Question 26: Searching and Sorting: Find position of an element in an Infinite Sorted Array

Question 27: Searching and Sorting: Job Sequencing with deadline Problem

Question 28: Searching and Sorting: Find the missing number in Arithmetic Progression

Question 29: Searching and Sorting: Factorial Trailing Zeroes

Question 3o: Searching and Sorting: Find the index of first 1 in an infinite sorted array of 0s and 1s

Question 31: Searching and Sorting: Peak Element

Question 32: Searching and Sorting: Find maximum element in Bitonic Array

Question 33: Searching and Sorting: Given a set of distinct integers, nums, return all possible subsets in CPP

Question 34: Searching and Sorting: Search An Element in Bitonic Array

Question 35: Searching and Sorting: Get the rotation count in sorted rotated array

Question 36: Searching and Sorting: Count the number of 1’s in an array sorted in decreasing order.

# LinkedList

Question 1: Linked List: Reverse Linked List iterative and recursive

Question 2: Linked List: Reverse Linked List in groups

Question 3: Linked List: Given a linked list, check if it has a cycle in it, solution in C++

Question 4: Linked List: Rotate linked list by k nodes

Question 5: Linked List: Given a linked list, if it has a cycle, get the node where the cycle begins else return NULL.

Question 7: Linked List: Remove duplicates from an unsorted linked list

Question 8: Linked List: Move last element to front of a given Linked List

Question 9: Linked List: Add 1 to the linked list

Question 11: Linked List: Find Intersection of Two Linked Lists

Question 13: Linked List: Given an unsorted linked list, sort the list using merge sort

Question 14: Linked List: Reverse Linked List given 2 points m and n

Question 15: Linked List: Find middle element in Linked List

Question 16: Linked List: Perform below operations on Circular Singly Linked List

Question 17: Linked List: Split circular Linked List into two halves

Question 18: Linked List: Program to Check if a Singly Linked List is Palindrome

Question 19: Linked List: Deletion from a Circular Linked List

Question 2o: Linked List: Reverse a Doubly Linked List

Question 21: Linked List: Find pairs with a given sum in a DLL.

Question 22: Linked List: Count triplets in a sorted DLL whose sum is equal to given value “k”.

Question 23: Linked List: Sort a “k”sorted Doubly Linked list

Question 24: Linked List: Rotate Doubly linked list by N nodes

Question 25: Linked List: Rotate a Doubly Linked list in group of Given Size

Question 26: Linked List: Merge two sorted linked lists and return it as a new list

Question 27: Linked List: Given linked list swap Nodes in Pairs

Question 28: Linked List: Flatten a Linked List

Question 3o: Linked List: Merge k sorted linked lists and return it as one sorted list in C++

Question 31: Linked List: Multiply two numbers represented by Linked Lists

Question 32: Linked List: Delete nodes which have a greater value on right side using recursion

Question 33: Linked List: Segregate even and odd nodes in a Linked List

Question 34: Linked List: Given a linked list Remove Nth Node From End of List

Question 35: Linked List: Odd Even Linked List

## Binary Trees

Question 1: Binary Trees: Level Order Traversal

Question 2: Binary Trees: Display Reverse Level Order Traversal by using queue

Question 3: Binary Trees: Height or Max depth of a BTree

Question 4: Binary Trees: Diameter of a Binary Tree

Question 5: Binary Trees: Convert a binary tree to its Mirror Tree

Question 6: Binary Trees: Perform InOrder traversal on a Binary Tree by without Recursion

Question 7: Binary Trees: Perform PreOrder traversal on a Binary Tree by without Recursion

Question 8: Binary Trees: Perform PostOrder traversal on a Binary Tree by without Recursion

Question 9: Binary Trees: Left view and right view of a Binary Tree

Question 1o: Binary Trees: Check if Binary Tree is Foldable Tree

Question 11: Binary Trees: Top view of a binary tree

Question 12: Binary Trees: Bottom view of binary Tree

Question 13: Binary Trees: Spiral order or Zigzag traversal of a Binary Tree

Question 14: Binary Trees: Check if binary tree is a height balanced tree?

Question 15: Binary Trees: Diagonal Traversal of a Binary tree

Question 16: Binary Trees: Boundary Traversal of Binary Tree

Question 17: Binary Trees: Get Maximum width of Binary Tree

Question 18: Binary Trees: Convert Binary Tree to DLL

Question 19: Binary Trees: Convert Binary tree into Sum tree

Question 2o: Binary Trees: Construct Binary Tree from preorder and inorder traversal

Question 21: Binary Trees: Minimum swap required to convert binary tree to binary search tree

Question 22: Binary Trees: Check if binary tree is a sum tree

Question 23: Binary Trees: Check if all Leaf Nodes are at same level in Binary tree

Question 24: Binary Trees: Find Duplicate Subtrees

Question 25: Binary Trees: Check if Two Trees are Mirror Structure to each other

Question 26: Binary Trees: Get Sum of all nodes formed from Root to Leaf Path

Question 27: Binary Trees: Check if a given graph is tree or not

Question 28: Binary Trees: Find largest subtree sum in a tree

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

Question 3o: Binary Trees: Print all the paths from root node to leaf node

Question 31: Binary Trees: Lowest Common ancestor of a Binary Tree.

Question 32: Binary Trees: Print the nodes at k distance from the root of a binary tree

Question 33: Binary Trees: Kth Ancestor of a Tree Node

Question 34: Binary Trees: Find Duplicate Subtrees

Question 35: Binary Trees: Check if two Binary Trees are Isomorphic

# Binary Search Trees

Question 1: Binary Search Trees: Find a value in a BST

Question 2: Binary Search Trees: Deletion of a node in a BST

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

Question 4: Binary Search Trees: Find the Inorder predecessor and successor for a given key in BST

Question 5: Binary Search Trees: A program to check if a binary tree is BST or not

Question 6: Binary Search Trees: Convert a BST into greater sum tree

Question 7: Binary Search Trees: LCA in a BST

Question 8: Binary Search Trees: Construct BST from preorder traversal

Question 9: Binary Search Trees: Convert Binary Tree into Binary Search Tree.

Question 1o: Binary Search Trees: Convert a normal BST into a Balanced BST

Question 11: Binary Search Trees: Merge Two balanced BST

Question 12: Binary Search Trees: Kth Largest Element in a BST

Question 13: Binary Search Trees: Kth smallest Element in a BST

Question 14: Binary Search Trees: Return the sum of given range in BST.

Question 15: Binary Search Trees: Get the Shortest distance between two nodes in BST

Question 16: Binary Search Trees: Count the number of BST nodes that lie in a given range.

Question 17: Binary Search Trees: Convert sorted DLL to Balanced BST

Question 18: Binary Search Trees: Find triplet sum in BST

Question 19: Binary Search Trees: Check if the pre-order is a valid BST

Question 2o: Binary Search Trees: Check if the BST has a dead end

Question 21: Binary Search Trees: Correct a BST where 2 nodes are swapped

Question 22: Binary Search Trees: Flatten BST to sorted list

# Greedy

Question 1: Greedy: Activity Selection Problem

Question 2: Greedy: Job Sequencing with deadline Problem

Question 3: Greedy: Remove duplicates from a string

Question 4: Greedy: Add elements in an array so the sum is equal to the given range

Question 5: Greedy: Fractional knapsack tutorial with implementation

Question 6:

Question 7: Greedy: Remove k digits from an number to make it a smallest integer.

Question 8: Greedy: Get the minimum platforms needed to avoid delay in the train arrival.

Question 9: Greedy: Check if the string is a substring of another string

Question 1o: Greedy: Remove overlapping intervals.

Question 11: Greedy: Plant n flowers in flower bed

Question 12: Greedy: Maximum meetings in one room

Question 13: Greedy: Distribute Candy

Question 14: Greedy: Shuffle array so that one array element is greater than other array element

Question 15: Greedy: Schedule task efficiently

Question 16: Greedy: Partition characters

Question 17: Greedy: Maximum sum of absolute difference of an array

Question 18: Greedy: Juice change

Question 19: Greedy: Given a string, split into balanced strings.

Question 2o: Greedy: Perform operations on a broker calculator

Question 21: Greedy: Add minimum to make parentheses valid.

Question 22: Greedy: Remove covered intervals.

Question 23:

Question 24: Greedy: Reduce the array size to the half

Question 25: Greedy: Connect ropes with minimum cost.

Question 26: Dijkstra’s Algorithm

Question 27:

Question 28: Kruskal’s algorithm

Question 29: Greedy: Connect ropes with minimum cost.

Question 3o:

Question 31:

Question 32: Greedy: Find maximum sum possible equal sum of three stacks

# BackTracking

Question 1: Backtracking: Partition string into its palindrome

Question 2: Backtracking: Letter Combinations of a Phone Number

Question 3: Backtracking: Solve Sudoku

Question 4: Backtracking: Check if the given board is valid Sudoku or not

Question 5: Backtracking: N-Queens

Question 9: Backtracking: Get the k combination from an array of 1 to n

Question 1o: Backtracking: Given array of integers that might contain duplicates, return all the subsets

Question 11: Backtracking: Find combination sum of k numbers that sum up to n

Question 13: Backtracking: Letter case permutation

Question 14: Backtracking: Return the number of queens possible in a chessboard

Question 15: Backtracking: Get the sequential digits from the given range

Question 16: Backtracking: Partition to K Equal Sum Subsets

Question 17: Backtracking: Get maximum sum in a matrix