## Convert Binary to Decimal number

in
Algorithm,
Bit Manipulation,
Interviews,
Java
- on 00:54:00
- No comments

## Check whether Binary Tree is foldable or not.

in
Algorithm,
Binary Tree,
Datastructure,
Interviews
- on 02:06:00
- No comments

## Print Fibonacci series using Recursive approach in Java

in
Interviews,
Java,
Miscellaneous
- on 00:59:00
- No comments

### Java Program to Print Fibonacci Series upto K Number.

In this post we will see how to Print Fibonacci series using Recursive approach in Java.

**Example:**

Java program to print fibonacci series up to a given number k.

Input = 5 Output = 0, 1, 1, 2, 3

Input = 2

Output = 0, 1

Input = 7

Output = 0, 1, 1, 2, 3, 5, 8

## Print Fibonacci series using Iterative approach in Java

in
Interviews,
Java,
Miscellaneous
- on 00:54:00
- No comments

### Java Program to Print Fibonacci Series upto K Number.

In this post we will see how to Print Fibonacci series using Iterative approach in Java.

**Example:**

Java program to print fibonacci series up to a given number k.

Input = 5 Output = 0, 1, 1, 2, 3

Input = 2

Output = 0, 1

Input = 7

Output = 0, 1, 1, 2, 3, 5, 8

## Fibonacci series Iterative and Recursive program in Java

in
Interviews,
Java,
Miscellaneous
- on 21:14:00
- No comments

###
Java Program to print Fibonacci series. OR

Java Program to Print Fibonacci Series upto K Number. OR

Iterative Program to print Fibonacci series. OR

Recursive Program to print Fibonacci series.

**What is Fibonacci Series?**

Fibonacci series is series of natural number where next number is equivalent to the sum of previous two number.

**Example:**

Java program to print fibonacci series up to a given number k.

Input = 5 Output = 0, 1, 1, 2, 3

Input = 2

Output = 0, 1

Input = 7

Output = 0, 1, 1, 2, 3, 5, 8

## Check if two nodes are cousins in a Binary Tree

in
Algorithm,
Binary Tree,
Datastructure,
Interviews
- on 11:18:00
- No comments

### Given two nodes in a binary tree, check if they are cousins.

Given the binary Tree and the two nodes say ‘p’ and ‘q’, determine whether the two nodes are cousins of each other or not.

**Two nodes are cousins if,**

- They are not siblings (Children of same parent).
- They are on the same level.

**Two nodes are cousins of each other if they are at same level and have different parents.**

Lets see few example for better understanding on when two nodes are said to be cousin of each other in Binary Tree.