1Arrays

- Given an array A and a number x, check for pair in A[] with sum as x
- Given an array with 'n' elements, Find a majority element in an array
- Find the number occurring odd number of times in a given elements
- A program to reverse an array
- Write a program to rotate array of size n by d elements
- Segregate 0's and 1's in an array
- Find the maximum difference between two elements such that larger element appears after the smaller number
- Write a program to Merge an array of size n into another array of size m+n.
- Find the two repeating elements in a given array
- Given an array contains n elements, find duplicate elements in O(n) time and O(1) extra space
- Find the equilibrium index of an array
- Given an array contains n elements, find the maximum difference of j - i such that a[j]> a[i]
- Find the triplet that sum to a given value
- Find a sub array with given sum
- Find the largest sub array with equal number of 0's and 1's
- Find the four elements in an array that sums to a given value
- Given an unsorted array of positive integers. Find the number of triangles that can be formed with three different array elements as three sides of triangles.
- Given two sorted arrays such the arrays may have some common elements. Find the sum of the maximum sum path to reach from beginning of any array to end of any of the two arrays.
- Find the smallest value integer value that can't be represented as sum of any subset of a given array
- Find common element in three sorted arrays
- Given an array containing both negative and positive numbers. Find the contiguous sub-array with maximum sum.
- Given an array of integer, sort the array into a wave like array and return it. (arrange the element into a sequence such that a1>=a2<=a3>=a4<=a5----etc.
- Implement the next permutation, which rearranges numbers into the numerically next greater permutation of numbers
- Find the sum of bit difference in all pairs that can be formed from array of n elements.
- Count number if binary strings without consecutive 1's
- Given 'n' non-negative integers in array representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining
- Given arrival and departure times of all trains that reach a railway station, find the minimum number of platforms required for the railway station so that no train waits
- Rotate 2D array without using extra space
- Given a set of n nuts of different sizes and n bolts of different sizes. Do one-to-one mapping between nuts and bolts efficiently.
- Rearrange an array so that a[i] becomes a[a[i]] with O(1) extra space
- Traverse a matrix of integers in spiral form
- Given an array consisting 0's, 1's and 2's, write a program that sorts A[].
- Find two numbers in an array with sum closest to zero
- Given a positive number x, print all jumping numbers smaller than or equal to x
- Given an array and an integer k, find the maximum, for each and every contiguous subarray of size k
- Search an element in a sorted rotated array
- Find the maximum value of a[j]<-a[i]+a[l]-a[k], such that i< j < k < l.

2Linked List

- Find the N
^{th}node from end of the linked list - Find a middle node in a linked list
- Find intersection point of two linked lists
- Reverse linked list
- Detect a loop in linked list
- Find starting node of a loop in a linked list
- Check given linked list is palindrome (or) not
- Reverse alternative K nodes in a SLL
- Clone a linked list with next and random pointer

3Stack

- Reverse a stack using recursion
- Find next greater element on the right side of an array.
- Implement the following operations in stack in O(1) time. Push(), pop(), isEmpty(), isFull() and getMin().
- Find the celebrity in minimum number of questions in a party.
- The stock span problem is a financial problem where we have a series of n daily price for a stock and we need to calculate span of stock’s price for all n days
- Merge all overlapping intervals into one.
- Find the largest rectangular area possible in a given histogram.
- Given an integer array of size n, find the maximum of the minimum’s of every window size in the array.
- Calculate minimum number of bracket reversals needed to make an expression balenced.
- Design a stack, to find getmin() in O(1) time and O(1) space complexity.
- Find if an expression has duplicate or not.

4Queue

- Given an array and an integer k, find the maximum for each and every contiguous subarray of size k.
- Implement LRU Cache.
- Find the first cicular tour that visits all petrol pumps
- Find the largest multiple of 3.

5Trees

- Implement in order traversal without stack and recursion
- Convert a binary tree into its mirror tree
- Check if a given binary tree is sum tree or not
- Determine if the given two trees are identical or not
- Print out all of its roof to leaf paths in a given binary tree
- Find a lowest common ancestor of a given two nodes in a abinary search tree
- Find a lowest common ancestor of a given two nodes in a binary tree
- Level order traversal in spiral form
- Convert an arbitrary binary tree to a tree that holds children sum property
- Find the Diameter of a BST
- Construct tree from given inorder and post order traversal
- Convert a Binary Tree to a circular DLL
- Evaluation of expression tree
- Print extreme node of each level of Binary Tree in alternative order
- Print cousins of a given node in Binary Tree
- Diagonal traversal of Binary Tree
- Construct tree from ancestor matrix
- Given a Binary Tree, find vertical sum of the nodes that are in same vertical line.
- Find multiplication of sums of data of leaves at same level.
- Given a binary tree, find maximum value we can get by subtracting value of node B from value of node A
- Print nodes in a top view of Binary Tree.
- Given a Binary Tree and a number k, remove all nodes that lie only on root to leaf path(s) of length smaller than k.
- Serialize and deserialize an N-ary tree.
- Reverse alternate levels of a perfect Binary Tree.
- Print all nodes that are at distance k from a leaf node.
- Custom tree problem.
- Construct complete binary tree from its linked list reprenration.
- Find next right nodes of given leafs in a binary tree.
- Given a binary tree, print boundary nodes of the binary tree Anti-Clockwise starting from the root.
- Convert a given tree to its sum tree.
- Given a binary tree, find out if the tree can be folded or not.
- Find largest subtree having identical left and right sub tree.
- Convert a normal binary search tree to balanced BST.
- Check if removing an edge can divide a binary tree in the form of n-ary tree.
- locking and unlocking of resource arranged on the form of n-ary tree.

6Heap

- Find K largest (or smallest) elements in array.
- Tournament tree method using binary heap .
- Find a Median in a stream of integers.
- Sort a nearly sorted array(or k sorted).
- Given array representation of min Heap, convert it to max Heap.
- Check if a given binary tree is Heap.
- Find k
^{th}largest element in a stream. - Print all elements in sorted order from row and column wise sorted matrix.
- Given n ropes of different length, connect with minimum cost.
- Given k sorted arrays of size n each, merge them.
- Design an efficient data structure for given operations find min(), findmax(), deletemin(), Insert(),delete()..

7Strings

- Find a maximum occurring character in the input string.
- Remove all duplicates from a given string.
- A program to check if strings are rotations of each other or not.
- Find the smallest window in a string containing all characters of another string
- Revere words in a given string.
- Find all distinct palindromic sub strings of a given string
- Remove all adjacent duplicate characters in a string
- Given a string, find the Run length encoding of given string.
- Check whether two strings are anagram of each other or not.
- Find the first non-repeating character from a stream of characters.
- Given an array of strings , find if the string can be of characters.
- Find a excel column name from a given column number.
- Convert one string to another using minimum number of given operation
- Check if a given sequence of moves for a robot is circular (or) not.
- Print concatenation of zig-zag string in 'n' rows.
- Minimum number of palindromic subsequence to be removed to empty a binary string.
- All combinations of string that can be used to dial a number.

8Divide & Conquer

- Find the median of two sorted arrays
- Count inversions in an array
- Find majority Element in a sorted array
- Find the maximum and minimum of an array using minimum number of comparisons
- The skyline problem
- Given two binary strings that represent value of two integers, find the product of two strings.
- Given an array of integers. Find a peak element in it.
- Find the missing number in Arithmetic Progression
- Given an array of n points in the plane, find out the closest pair of points in the array.

9Greedy Algothims

- Given an array of jobs with different time intervals. Find the minimum time to finish all jobs.
- Given a universe of n elements, collection of subsets. Find a minimum cost sub collection that covers all elements.
- Given n cities and distances between every pair of cities, select k cities to place warehouses, such that the maximum distance of a city to a warehouse is minimized.

10Back Tracking

- Print all permutations of a given string.
- Find subset of elements that are selected from a given set whose sum adds up to a given number K.
- Given a set of n integers, divide the set in two subsets of n/2 sizes each such that the difference of the sum of two subsets is as minimum as possible.
- Solve sudoku using backtracking.
- Given a maze, NxN matrix. A rat has to find a path from source to destination. Left top corner is the source and right bottom corner is destination. There are few cells which are blocked, means rat can¬not enter into those cells.

11Pattern searching

- Given a text and a pattern, find all occurrences of pattern in a given text. Using navie approach.
- Given a text and a pattern, find all occurrences of pattern in a given text. Using Rabin-Karp algorithm.
- Given a text and a pattern, find all occurrences of pattern in a given text. Using Finite automata appraoch.
- iven a text and a pattern, find all occurrences of pattern in a given text. Using Boyer moore algorithm.
- Given a text and a pattern, find all occurrences of pattern in a given text. Using KMP algorithm.
- Given a string, find the longest substring which is palindrome using manacher’s algorithm
- Find all occurences of a given word in a matrix.

12Dynamic Programming

- Find the length of the longest subsequence of a given sequence such that all elements of the subsequence are sorted in increasing order.
- Given two sequences, find the length of longest subsequence present in both of them.
- Given a cost matrix and a position (m, n) , Find cost of minimum cost path to reach (m, n) from (0, 0).
- Coin change problem.
- Find the length of the longest palindrome subsequence.
- Find th sum of maximum sum subsequence of the given array.
- You have a rectangular grid of dimension 2 x n. You need to find out the maximum sum such that no two chosen numbers are adjacent , vertically, diagonally (or) horizontally.
- Given an array A with n elements and array B with m elements. With m you have to insert (n-m) zero's in between array B such that the dot product of array A and array B is maximum.
- Transform a string into palindrome on removing atmost k characters from it.
- Find the longest even length sub string such that sum of first and second half is same..
- Count number of ways to reach a given score in a game.
- Compute sum of digits in all number from 1 to n.
- Collect maximum points in a grid using two traversals
- Given a 2xn board and titles of size 2x1, count the number of ways to tile he given board using the 2x1 tiles..
- Count the number of ways we can parenthesize the expression so that the value of expression evaluates to true.
- Given a Binary Tree, find size of the Largest Independent Set(LIS) in it.
- There are n stairs, a person standing at the bottom wants to reach the top. The person can climb either 1 stair or 2 stairs at a time. Count the number of ways, the person can reach the top.
- Find total number of non-decreaing numbers with n digits.
- Egg dropping problem.
- Given a rod of length n inches and an array of prices that contains prices of all pieces of size smaller than n. Determine the maximum value obtainable by cutting up the rod and selling the pieces.
- Given N jobs where every job is represented by Start Time, Finish Time, Profit or Value Associated. Find the maximum profit subset of jobs such that no two jobs in the subset overlap.
- Box stacking problem.
- Given an input string and a dictionary of words, find out if the input string can be segmented into a space-separated sequence of dictionary words.
- Given a binary matrix, find out the maximum size square sub-matrix with all 1s.
- Find the maximum coins you can collect by bursting the ballons wisely.