Given an array of integers in ascending order, return index of the two numbers such that they add up to a specific key provided.
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.
Count the number of ways a baby can reach the n’th stair taking 1 or 2 steps at a time in C language.
Sort an array of 0s, 1s and 2s in C
Given an array, the difference between the elements is one, find if the “key” element is present or not.
Given an unsorted array, find the minimum difference between 2 elements.
Given an unsorted array, find the least difference between the element pairs. Display all the pairs present.
Given an unsorted array, and a key. Find 2 elements such that the difference between the elements is equal to the key.
Given an unsorted integer array, find the smallest missing positive integer.
Given an array, find all the repeated elements in C language.
Given an integer value, convert it into roman number.
Given a string, and number of rows, write the string in zigzag pattern.
Dynamic Programming: Longest Palindromic Substring In C++
Given an input string (s) and a pattern (p), implement regular expression matching with support for ‘.’ and ‘*’.
Find the Container with Most Water explanation with diagram and solution
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.
Given an array, find 3 elements such that [a + b + c] = 0. Find all the 3 unique elements.
Given an array of n integers and an integer “key”, find three integers in the array such that the sum is closest to key.
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.
Remove Nth Node from End of List
Letter Combinations of a Phone Number
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.
Swap Nodes in Pairs solution in C
Given two integers dividend and divisor, divide two integers without using multiplication, division and mod operator.
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.
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
Merge k sorted linked lists and return it as one sorted list in C++
Given a collection of candidate numbers and a key, find all unique combinations in candidates where the candidate numbers sums to target.
Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.
Given a collection of distinct integers, return all possible permutations.
Given a collection of numbers that might contain duplicates, return all possible unique permutations in C++
You are given an n x n 2D matrix rotate it by 90 degrees (clockwise) in C++.
Group Anagrams in C++
Rain water trapping
Implement pow(x, n), which calculates x raised to the power n (xn) in C++
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.
Given an array of non-negative integers determine if you are able to reach the last index in C++
Merge Intervals in C++
Reverse Linked List iterative and recursive in C++
Given a positive integer n, generate a square matrix filled with elements from 1 to n2 in spiral order in C++
Wildcard Matching
Intersection of Two Linked Lists in c++
Rotate linked list by k nodes
Unique Paths Solution in CPP
Unique Paths II in CPP
Minimum Path Sum in CPP
Simplify Path CPP
Jump Game II in CPP
Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in-place.
Search a 2D Matrix in C++
Sort Colors In Place
Given two integers n and k, return all possible combinations of k numbers out of 1 … n.
Given a set of distinct integers, nums, return all possible subsets (the power set).
Given a 2D board and a word, find if the word exists in the grid.
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.
Given a sorted array nums, remove the duplicates in-place such that duplicates appeared at most twice and return the new length.
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.
Remove Duplicates from Sorted List solution in CPP
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.
The gray code is a binary numeral system where two successive values differ in only one bit.
Subsets II in CPP
check if the given string is valid or not explanation with solution
Decode Ways
Reverse a linked list from position m to n. Do it in one-pass.
Restore IP Addresses
Insert Interval
Given a non-negative integer numRows, generate the first numRows of Pascal’s triangle.
Pascal’s triangle 2
Check if the given board is valid Sudoku or not explanation with solution in CPP
Given a triangle, find the minimum path sum from top to bottom.
Best time to buy sell stock
Woord Ladder
Surrounded Regions
Given a string s, partition s such that every substring of the partition is a palindrome.
Soduku Solver
Given a non-empty array of integers, every element appears twice except for one. Find that single one.
Given a linked list, determine if it has a cycle in it.
Given a sentence and maxWidth. Arrange the text in such a way that each line has exactly maxWidth characters and is fully justified.
Reorder list in to alternate nodes like first lowest and first highest.
Sort a linked list using insertion sort.
Given an unsorted linked list, sort the list using merge sort.
Given an expression in reverse polish notation, evaluate it and get the output in C++
You are given a sentence, reverse the string word by word
Given an integer array, find the maximum product made from continuous elements in that array. Solution in C++
Find the minimum element from an array that is sorted and is rotated, solution in C++
Arrays: Find unique numbers that sum upto zero
Arrays: Find numbers with even number of digits
Searching and Sorting: Find the majority element in the array
Given an array, find the majority element, solution in C++
Given 2 strings, check if they are isomorphic strings.
Given an array and a key element, find the number of continuous elements whose sum is greater than the key element.
Given the heights of histogram using an array, you need to find the largest area rectangle in that histogram. Solution in C++
You are given an unsorted array, and a key number, find the largest number of that key position.
Given a 2d matrix, filled with 1 and 0. Find the maximum sub-matrix that has only 1’s and return the area.
You are given a string that contain a basic expression, calculate the result. Solution in C++.
C++ program to implement queue using stacks.
Given a linked list, check if it is a palindrome or not. Solution in C++
Given an array, that has zero. Move all the zero at the end, but maintain the relative order of other elements.
Get difference between values at Even and Odd level in a binary tree
Get Number of Nodes in a Binary Tree
Display nodes at given level in Binary Tree
Display Reverse Level Order Traversal by using queue
Perform PreOrder traversal on a Binary Tree by without Recursion
Perform InOrder traversal on a Binary Tree by without Recursion
Perform PostOrder traversal on a Binary Tree by without Recursion
Convert a binary tree to its Mirror Tree
Check if Two Trees are Mirror Structure to each other
Delete a binary tree
Get Level of a Given Node
Get Sum of elements Level wise in a Binary Tree
Get Maximum width of Binary Tree
Display elements between any two given level
Check if binary tree is a height balanced tree?
Check if all Leaf Nodes are at same level in Binary tree
Find Parent of a given node value in Binary Tree
Check if given Binary Tree is BST
Find Sibling node of a given node value in Binary Tree
Check if given two nodes are siblings to each other in Binary Tree
Get Sum of all nodes formed from Root to Leaf Path
Get Average of all nodes in Binary Tree
Get Sum of all Leaf Nodes in Binary Tree
Find Maximum or Minimum in Binary Tree
Check if Binary Tree is Foldable Tree
Check if two Binary Trees are Isomorphic
Get Vertical Sum of Binary Tree
Get deepest Left Leaf Node in Binary Tree
Get depth of Odd level which contains Leaf node in Binary Tree
Display all the leaf nodes from left to right and right to left in a tree
Get count Non-Leaf nodes in a Binary Tree
Get the count full nodes in a Binary
Binary search on an array that is in descending order
Order-Agnostic Binary Search
Find the first and last occurrence of an element
Find the number of times a Sorted array is Rotated
Searching in a Nearly Sorted Array
Find Floor of an element in a Sorted Array
Find Ceil of an element in a Sorted Array
Find position of an element in an Infinite Sorted Array
Find the index of first 1 in an infinite sorted array of 0s and 1s
Peak Element
Find maximum element in Bitonic Array
Search An Element in Bitonic Array
Get the rotation count in sorted rotated array
Count the number of 1’s in an array sorted in decreasing order.
Reverse Bits
Count the number of set bits
Power of 2
Missing Number
Counting set bits in a number
Hamming Distance
Bitwise and of number range
Bottom view of binary Tree
Boundary Traversal of Binary Tree
Top view of a binary tree
Left view and right view of a Binary Tree
Level Order Traversal
Vertical Order Traversal
Height or Max depth if a BTree
Spiral order or Zigzag traversal of a Binary Tree
Diameter of a Binary Tree
Lowest Common ancestor of a Binary Tree.
Check if 2 nodes are mirror of each other
Check if 2 binary tree are identical
Check if binary tree is a sum tree
Add all the node values in a Binary Tree or Sum of a Binary tree
Print the number of leaf nodes in a binary tree
Print all the paths from root node to leaf node
Print the nodes at k distance from the root of a binary tree
Dynamic Programming: Longest Increasing Subsequence
Dynamic Programming: Longest Bitonic Subsequence
Get Max Coin In Game problem.
Strings: Longer Contiguous Segments of Ones than Zeros
Strings: Check if Word Equals Summation of Two Words
Arrays: Check if 3 consecutive odds exist
Arrays: Check If N and Its Double Exist
Dynamic Programming: Min Edit Distance
Reverse an array
Find the Maximum and minimum of an array
Arrays: Find the k’th smallest/largest element in an array
Arrays: Move all the negative number in beginning
Arrays: Find the union and intersection of two sorted arrays
Arrays: Given an array, rotate it one time
Arrays: Minimize the maximum difference between the heights
Arrays: Given an array find the duplicate number
Arrays: Merge Two Sorted arrays without using extra space
Arrays: Inversion Count in an Array
Arrays: Find common element in 3 sorted arrays.
Arrays: Rearrange the array with one positive and one negative number.
Arrays: Find whether an array is subset of another array
Arrays: Find a triplet that sum to a given value
Arrays: Three way partitioning of an array around a given range
Arrays: Minimum swaps required to bring all elements less than or equal to k together
Arrays: Get minimum number of merge operations to make an array palindrome
Arrays: Find the median of 2 sorted arrays of same size
Matrix: Find median in a row wise sorted matrix.
Matrix: Find a row with maximum number of 1’s in a binary matrix
Matrix: Kth smallest element in a sorted matrix
Matrix: Get the common elements in all row of a matrix.
Strings: Reverse a string
Strings: Print all the duplicates in a string
Strings: Program to check if strings are rotations of each other or not
Strings: Longest Repeating Subsequence
Strings: Given a string, print all the subsequence
Strings: Permutations of a given string
Strings: Divide binary string into sub strings with equal number of 0s and 1s.
Strings: Check balanced parenthesis
Strings: Word Break Problem
Strings: Convert a string into its mobile numeric keypad
Strings: Get the minimum number of inversions needed to make an expression balanced
Strings: Count the number of string in 2D character array
Strings: Convert Roman Numerals to Decimal
Strings: Longest Common Prefix
Strings: Minimum number of flips to make binary string alternate
Strings: Find the first repeated word in a string
Strings: Minimum swaps required for bracket balancing
Strings: Find the longest common subsequence between two strings.
Strings: Smallest distinct window
Strings: Check if it is possible to re-arrange characters in a string, such a way that no two adjacent are same
Minimum characters to be added at beginning to make string palindrome
Strings: Minimum Window Substring
Strings: Remove all consecutive duplicates from the string
Strings: Find minimum operations required to transform a string into another string
Strings: Recursively print all sentences that can be formed from list of word lists
Searching and Sorting: Get the fixed point in an array
Searching and Sorting: Maximum and minimum of an array using minimum number of comparisons
Searching and Sorting: Search an array where adjacent differ by at most k
Searching and Sorting: Count all distinct pairs with difference equal to k
Searching and Sorting: Maximum sum such that no two elements are adjacent
Maximum sum such that no two elements are adjacent
Searching and Sorting: Merge 2 sorted arrays
Searching and Sorting: print all subarrays with 0 sum
Searching and Sorting: Product of array except itself.
Searching and Sorting: Sort Integers by The Number of 1 Bits
Searching and Sorting: Minimum number of swaps required to sort an array
Searching and Sorting: K-th Element of Two Sorted Arrays
Searching and Sorting: Find the missing number in Arithmetic Progression
Searching and Sorting: Factorial Trailing Zeroes
Linked List: Reverse Linked List in groups
Linked List: Remove duplicates from an unsorted linked list
Linked List: Move last element to front of a given Linked List
Linked List: Add 1 to the linked list
Linked List: Find middle element in Linked List
Linked List: Split circular Linked List into two halves
Linked List: Program to Check if a Singly Linked List is Palindrome
Linked List: Deletion from a Circular Linked List
Linked List: Reverse a Doubly Linked List
Linked List: Find pairs with a given sum in a DLL.
Linked List: Count triplets in a sorted DLL whose sum is equal to given value “k”.
Linked List: Sort a “k”sorted Doubly Linked list
Linked List: Rotate Doubly linked list by N nodes
Linked List: Rotate a Doubly Linked list in group of Given Size
Linked List: Flatten a Linked List
Linked List: Multiply two numbers represented by Linked Lists
Linked List: Delete nodes which have a greater value on right side using recursion
Linked List: Segregate even and odd nodes in a Linked List
Binary Trees: Diagonal Traversal of a Binary tree
Binary Trees: Convert Binary Tree to DLL
Binary Trees: Convert Binary tree into Sum tree
Binary Trees: Construct Binary Tree from preorder and inorder traversal
Binary Trees: Minimum swap required to convert binary tree to binary search tree
Binary Trees: Find Duplicate Subtrees
Binary Trees: Check if a given graph is tree or not
Binary Trees: Find largest subtree sum in a tree
Binary Trees: Maximum Sum of nodes in Binary tree such that no two are adjacent
Binary Trees: Kth Ancestor of a Tree Node
Binary Trees: Find Duplicate Subtrees
Binary Search Trees: Find a value in a BST
Binary Search Trees: Deletion of a node in a BST
Binary Search Trees: Find min and max value in a BST
Binary Search Trees: Find the Inorder predecessor and successor for a given key in BST
Binary Search Trees: A program to check if a binary tree is BST or not
Binary Search Trees: Convert a BST into greater sum tree
Binary Search Trees: LCA in a BST
Binary Search Trees: Construct BST from preorder traversal
Binary Search Trees: Convert Binary Tree into Binary Search Tree.
Binary Search Trees: Convert a normal BST into a Balanced BST
Binary Search Trees: Merge Two balanced BST
Binary Search Trees: Kth Largest Element in a BST
Binary Search Trees: Kth smallest Element in a BST
Binary Search Trees: Return the sum of given range in BST.
Binary Search Trees: Get the Shortest distance between two nodes in BST
Binary Search Trees: Count the number of BST nodes that lie in a given range.
Binary Search Trees: Convert sorted DLL to Balanced BST
Binary Search Trees: Find triplet sum in BST
Binary Search Trees: Check if the pre-order is a valid BST
Binary Search Trees: Check if the BST has a dead end
Binary Search Trees: Correct a BST where 2 nodes are swapped
Binary Search Trees: Flatten BST to sorted list
Greedy: Remove duplicates from a string
Greedy: Add elements in an array so the sum is equal to the given range
Greedy: Remove k digits from an number to make it a smallest integer.
Greedy: Get the minimum platforms needed to avoid delay in the train arrival.
Greedy: Check if the string is a substring of another string
Greedy: Remove overlapping intervals.
Greedy: Plant n flowers in flower bed
Greedy: Maximum meetings in one room
Greedy: Distribute Candy
Greedy: Schedule task efficiently
Greedy: Shuffle array so that one array element is greater than other array element
Greedy: Maximum sum of absolute difference of an array
Greedy: Partition characters
Greedy: Juice change
Greedy: Given a string, split into balanced strings.
Greedy: Perform operations on a broker calculator
Greedy: Add minimum to make parentheses valid.
Greedy: Remove covered intervals.
Greedy: Reduce the array size to the half
Greedy: String break problem
Greedy: Connect ropes with minimum cost.
Greedy: Find maximum sum possible equal sum of three stacks
Backtracking: Partition string into its palindrome
Backtracking: You are given an array with repeated elements and a key element, find all unique combination to the key
Backtracking: Get the k combination from an array of 1 to n
Backtracking: Find combination sum of k numbers that sum up to n
Backtracking: Letter case permutation
Backtracking: Get the sequential digits from the given range
Backtracking: Return the number of queens possible in a chessboard
Backtracking: Partition to K Equal Sum Subsets
Backtracking: Get maximum sum in a matrix
Stack: Implement two stacks in an array
Stack: Delete the middle element from the stack.
Stack: Check for balanced brackets using stack
Stack: Next Greater Element
Stack: Evaluate postfix expression
Stack: Insert at the end of stack
Stack: Reverse a stack using recursion
Stack: Sort a stack
Stack: Largest Rectangular Area in a Histogram
Stack: Length of the longest valid substring
Stack: Expression contains redundant bracket or not
Stack: Implement Stack using Queues
Stack: Check if a stack is a permutation of another stack
Stack: Queue Reversal
Stack: Reverse the first “K” elements of a queue
Stack: Next Smaller Element
Heaps: Build Min Heap from an Array
Heaps: Sort an Array using heap
Heaps: Find kth smallest in an unsorted array
Heaps: Merge “K” sorted arrays
Detect a cycle in a directed graph
Detect a cycle in a undirected graph
0 1 Knapsack Problem using Dynamic Programming
Dynamic Programming: Binomial Coefficiet Problem
Dynamic Programming: Permutation Coefficient
Dynamic Programming: Get the nth catalan number
Dynamic Programming: Subset sum problem
Dynamic Programming: Unbounded Knapsack Problem
Dynamic Programming: Equal Sum partition
Find the two non repeating numbers.
Count number of bits to be flipped to convert A to B
Bitwise Set bit questions
Copy set bits in a range
Power Set
Arrays: Merge sorted array inplace
Arrays: Find triplet with minimum sum
Arrays: Program to check if an Array is Palindrome or not
Strings: Remove all consecutive duplicates from the string
Strings: Given a string convert into its equivalent ASCII form
Strings: Second most repeated word in a sequence
Matrix: Find pair with maximum sum in the matrix.
Searching and Sorting: Find the smallest and second smallest elements in an array
Linked List: Odd Even Linked List
Convert Postfix to Infix
Design a stack that returns the minimum element in constant time.
Strings: Longest Prefix Suffix
Check if the given edge is a bridge in the graph
Check if undirected graph is connected or not
Count the number of connected components in an undirected graph
Reverse a directed graph
Given a directed graph, check if the incoming edges of a vertex is equal to the vertex itself.
Check if the undirected graph is a tree or not
Given an directed graph, find the in and out degree of all vertices
Find there is a path between 2 nodes in a directed graph
Get the maximum sum of values of nodes among all connected components of an undirected graph
Get the unique lengths of connected components of an undirected graph.
Find if there is a path between 2 nodes in an undirected graph
Check if a graph is a strongly connected using Kosaraju DFS algorithm
Dice Sum Problem
Climb the stairs with minimum cost
Count the ways to decode a digit sequence
Get the nth Fibonacci Number
Get the least number of perfect squares
Unique Binary Search Trees
Robbing Houses
Get the sum by deleting elements from the array
Dynamic Programming: Count of subset sum with a given sum
Dynamic Programming: Minimum subset difference
Dynamic Programming: Target Sum
Dynamic Programming: Count the number of subset with a given difference
Dynamic Programming: Minimum Number of swaps to make array increasing
Dynamic Programming: Longest Common Subsequence
Dynamic Programming: Print Longest Common Sub-sequence
Dynamic Programming: Length of Shortest Common Supersequence
Dynamic Programming: Print Shortest Common Supersequence
Dynamic Programming: Minimum number of deletions and insertions to convert one string into another
Dynamic Programming: Longest repeating subsequence
Dynamic Programming: Check if one string is a subsequence of another
Dynamic Programming: Count how many times string 1 appears as substring in string 2.
Dynamic Programming: Longest Common Substring
Dynamic Programming: Get the count of delete operations on 2 strings.
Stack: Get the min element of the stack in O(1) time
Calculate the basic arithmetic expression as string
Calculate an expression with * and /
Given an encoded string, decode string
Stack: Get the next greater element in a circular array
Check if given 2 strings are same with backspace character
Stack: Remove outer most redundant parenthesis
Stack: Remove All Adjacent Duplicates In String
Stack: Build an Array With Stack Operations
Stack: Make digit minimum by removing k digits.
Stack: Minimum Insertions to Balance a Parentheses String
Stack: Check if the given pattern exist in the array
Score of Parentheses
Stack: Validate stack operations
Heap: Kth smallest element.
Heap: Return k largest element
Heap: Sort a K sorted array or nearly sorted array
Heap: K closest number
Heap: Top K Frequent Elements
Heap: Frequency sort
Heap: Top K Frequent Words
Heap: Connect ropes with minimum cost
Heap: Sum of all the elements between k1 and k2 smallest elements
Heap: kth largest element in a stream
Strings: Number of Different Integers in a String
Strings: Longest Substring Of All Vowels in Order
Strings: Minimum Number of Swaps to Make the Binary String Alternating
Dynamic Programming: Rod Cutting Problem
Dynamic Programming: Box Stacking Problem
Building Bridges
Egg Dropping Problem