## Dynamic Programming – Stairs Climbing Puzzle

Objective: A child is climbing up a staircase with n steps, and can hop either 1 step, 2 steps, or 3 steps at a time. Implement a method to count how many possible ways...

Skip to content# Category: Facebook

## Dynamic Programming – Stairs Climbing Puzzle

## Dynamic Programming – Minimum Coin Change Problem

## Merge K Sorted Arrays

## Diameter Of a Binary Tree

## Find the Height of a tree without Recursion

## Print All the Subsets of a Given Set (Power Set)

## Print All Combinations of subset of size K from Given Array

## Print All Possible Valid Combinations Of Parenthesis of Given ‘N’

## Implement Queue Using Stacks

## Merge Sort in a Linked list

## Construct Binary Search Tree from a given Preorder Traversal Using Stack (Without Recursion)

## Construct Binary Search Tree from a given Preorder Traversal using Recursion

## In an Array, find the Smallest Subarray with Sum Greater than the Given Value

## Find All Elements in an Array which appears more than N/K times, N is Array Size and k is a Number.

## Print All The Nodes Which are X distance from the Given Node

@tutorialhorizon

Objective: A child is climbing up a staircase with n steps, and can hop either 1 step, 2 steps, or 3 steps at a time. Implement a method to count how many possible ways...

Objective: Given a amount ‘A’ and n coins, v1<v2<v3<………..<vn . Write a program to find out minimum numbers of coins required to make the change for the amount ‘A’. Example: Amount: 5 Coins []...

Objective: Given k sorted array, write an algorithm to merge Them into One sorted array. Example : int[][] A = new int[5][]; A[0] = new int[] { 1, 5, 8, 9 }; A[1] =...

Objective: – Given a binary tree, write an algorithm to find the diameter of the tree. What is Diameter Of a Tree: Diameter of tree is defined as A longest path or route between...

Objective: – Find the Height of a tree without Recursion. In our earlier post “Height of tree” we had used recursion to find it. In this post we will see how to find it...

Objective: Given a set of numbers, print all the posssible subsets of it including empty set. Power Set: In mathematics, PowerSet of any given set S, PS(S) is set of all subsets of S...

Objective: Given an array of integers of size N, print all the subsets of size k. (k<=N) Example: Generate all subsets of a fixed size k of a given set [1,2,3…n]. e.g, if n=5...

ObjecÂtive: – Given “n”, generate all valid parenthesis strings of length “2n”. Example: Given n=2 Output: (()) ()() Approach:

Objective: We know that Queue is FIFO (First-in-First-Out) and Stack is LIFO ( Last-in-First-Out). Here our objective is to implement queue using stacks. Approach: Take 2 Stacks, stack1 and stack2. stack1 will be used...

Objective: Given a Linked List, Sort it using merge sort. Example: ->9->3->4->2->5->1 Sorted List: ->1->2->3->4->5->9 Approach: Reference : Merge Sort in array As it Merge sort, we apply the same logic , Divide and...

Objective: – Given a preorder traversal, construct BST from that, without using recursion. Input: Preorder traversal Similar Problem : This problem is similar to the Construct Binary Search Tree from a given Preorder Traversal...

Objective: – Given a preorder traversal, construct BST from that. Input: Preorder traversal Similar Problem : This problem is similar to the – Construct Binary Search Tree from a given Preorder Traversal Using Stack...

Objective: Given an array and an integer, find the smallest subarray whose sum is greater than the given integer. Examples: arrA[] = { 1, 5, 20, 70, 8} Integer = 97 Output : Min...

Objective: Given an array of size of N and number k. Find all elements in an Array which appears more than N/K times. Input: Array [] and number k. Example: int[] arrA = {...

Objective: – Given Binary Tree, Print All The Nodes Which are X distance from the Given Node. Example : Approach: Quite Tricky solution, i will explain using the example given in the picture.

%d bloggers like this: