**Objective:** Given a binary tree, find the height of a given node in the tree.

**Input:** A Binary Tree and a node

**Output: **Height of a given node in the tree.

**Example: **

**Approach:****Recursion:**

Objective: Given a string, write an algorithm to find the first non repeating character in it. Example: String input = … Read more

Objective: Given a string, write an algorithm to find the first repeating character in it. Example: String input = “horizon … Read more

Objective: Write an algorithm to implement Stack using Linked List. If you do not know about then for starters its … Read more

Objective: Given a binary tree and a given number x, Write a recursive algorithm to search the element in the … Read more

Objective: Given an array of integers. find the Kth Smallest/largest element in the array. Example int[] A = { 1, … Read more

Objective: A child is climbing up a staircase with n steps, and can hop either 1 step, 2 steps, or … Read more

Objective: Given an array of integers, in which every element occurs even a number of times except one number which … Read more

Objective: Given a decimal number, convert it into irreducible fraction. Irreducible Fraction : An irreducible fraction is a fraction in … Read more

Objective: Given a Linked List and x and y. Delete x number of nodes after y nodes from the start. … Read more

**Objective:** Given a binary tree, find the height of a given node in the tree.

**Input:** A Binary Tree and a node

**Output: **Height of a given node in the tree.

**Example: **

**Approach:****Recursion:**

Objective: Write a program to Reverse the binary representation of a number Example: Input : 30 Output : 15 Explanation … Read more

Objective: Write an algorithm to check if one string is Rotation of another string. This question has been asked in … Read more

**Objective:** This question was asked in Amazon interview for the Software development Engineer position, Write an algorithm to print all the elements of two dimensional array in spiral.**Example :**

**Input:** Two dimensional array

**Output:** All array elements printed in spiral.

**Approach:**

**Objective**: You have been asked to write an algorithm to find Whether Given the Sequence of parentheses is well-formed. This question was asked in the Amazon Interview.

**Input**: A String contains a sequence of parentheses

**Output**: true or false on whether parentheses are well-formed or not

**Approach**:

- Idea is to have two counters, one for open parentheses ‘{‘ and one for close ‘}’
- Read one character at a time and increment one of the counters
- If any given point of time count of close parentheses is greater than the open one, return false
- If at the end both counters are equal, return true

**Example: { { } { } } – Well-formed**

**{ { } { = Not well-formed**

**Code:**

**Objective:** Write an algorithm to find an element in 2-dimensional array where rows and columns are sorted respectively.

**Input:** A two dimensional sorted array, arrA[][].

**Output: **True or false based on whether the element exists and its location

**Approach:**