## Postorder Tree Traversal

Given a binary tree, return the post-order traversal of its nodes’ values. For traversing a binary tree in post-order fashion, we must do these three things for every node N

## Preorder Tree Traversal

Given a binary tree, return the pre-order traversal of its nodes’ values. For traversing a binary tree in pre-order fashion, we must do these three things for every node N

## Inorder Tree Traversal

Given a binary tree, return the inorder traversal of its nodes’ values. For traversing a binary tree in in-order fashion, we must do these three things for every node N

## LeetCode – Circular Permutation in Binary Representation (Java)

Given 2 integers n and start. Your task is return any permutation p of (0,1,2…..,2^n -1) such that : p = start p[i] and p[i+1] differ by only one bit

## Check if Binary trees are Symmetric or Not

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).Return 0 / 1 ( 0 for false, 1 for true ) for this

## How to check if two Trees are Identical or Not?

Given two binary trees, write a function to check if they are equal or not. “Two binary trees are considered equal if they are structurally identical and the nodes have

## LeetCode – Two Sum IV – Input is a BST

Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target. Example

## LeetCode – Validate IP Address

Write a function to check whether an input string is a valid IPv4 address or IPv6 address or neither. IPv4 addresses are canonically represented in dot-decimal notation, which consists of

## LeetCode – Reverse Words in a String

Given an input string, reverse the string word by word. Example 1: Input: “the sky is blue” Output: “blue is sky the” Example 2: Input: ” hello world! ” Output:

## Find pair with given difference K in the array

Given an array A of integers and another non-negative integer K, find if there exist 2 indices i and j such that A[i] – A[j] = K, i != j.

## Find Path with Maximum Gold

In a gold mine grid of size m * n, each cell in this mine has an integer representing the amount of gold in that cell, 0 if it is

## Largest Continuous Sub Array with Zero Sum – Java

Find the largest continuous sequence in an array which sums to zero. Example: Input: { 1 , 3 , -1 , 2 , -4 , 1} Output: {3 , -1

## Colorful Number

For Given Number N find if its COLORFUL number or not Number is COLORFUL number if product of every digit of a contiguous subsequence is different. A number can be

## LeetCode – Minimum Absolute Difference

Given an array of distinct integers arr[], find all pairs of elements with the minimum absolute difference of any two elements. Return a list of pairs in ascending order(with respect

## Given an Array of Integers and Target Number, Find Pair having Sum as Target

Given an array of integers A[], find two numbers such that they add up to a specific target number B. The program should return indices of the two numbers such

## Group all anagrams from a given array of Strings

Given an array of strings, return all groups of strings that are anagrams. Represent a group by a list of integers representing the index in the original list. Look at

## Towers Of Hanoi Algorithm

Towers Of Hanoi Algorithm The towers of hanoi is a mathematical puzzle. We have three towers (or rods or pegs), and a number of disks of different sizes which can

## Selection Sort Algorithm

Selection Sort Algorithm Selection sort is a sorting algorithm, specifically an in-place comparison sort. It has O(n2) time complexity, making it inefficient on large lists, and generally performs worse than

## Quick Sort Algorithm

Quick Sort Algorithm Quick sort (sometimes called partition-exchange sort) is an efficient sorting algorithm. It is a commonly used algorithm for sorting. When implemented well, it can be about two

## Merge Sort Algorithm

Merge Sort Algorithm Merge sort algorithm is an efficient, comparison-based sorting algorithm. Most implementations produce a stable sort, which means that the implementation preserves the input order of equal elements

## Insertion Sort Algorithm

Insertion Sort Algorithm Insertion sort algorithm is a simple sorting algorithm that builds the final sorted array (or list) one item at a time. It is much less efficient on

## Linear or Sequential Search Algorithm

Linear or Sequential Search Algorithm Linear or sequential search algorithm is a method for finding a target value within a list. It sequentially checks each element of the list for

## Bubble Sort Algorithm

Bubble Sort Algorithm Bubble sort algorithm, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through the list to be sorted, compares each pair of

## Binary Search Algorithm

Binary Search Algorithm Binary search algorithm requires already sorted collection. Binary search, (also known as half-interval search, logarithmic search, or binary chop) is a search algorithm that finds the position