Find out middle index where the sum of both ends is equal.

Description: You are given an array of numbers. Find out the array index or position where the sum of numbers proceeding the index equals to the sum of numbers succeeding the index.

Output Starting from index 0, adding numbers till index 2 and adding rest of the numbers can be equal

Continue reading


Find out duplicate number between 1 to N numbers.

Description: You have got a range of numbers between 1 to N, where one of the number is repeated. You need to write a program to find out the duplicate number.

Output: Duplicate Number: 22

Continue reading


How to reverse Singly Linked List?

Description: Write a sample code to reverse Singly Linked List by iterating through it only once. Recursive Method: 1) Divide the list in two parts – first node and rest of the linked list. 2) Call reverse for the rest of the linked list. 3) Link rest to first. 4) Fix head pointer.

OutPut […]

Continue reading


Common Elements Between Three Arrays

Program: Write a program to find common elements between three arrays. Description: Write a program to identify common elements or numbers between three given arrays. You should not use any inbuilt methods are the list to find common values.

Output 3

Continue reading


Even Odd Number Example

Even Odd Number Example This Java Even Odd Number Example shows how to check if the given number is even or odd.

  Output of the program would be

 

Continue reading


Calculate Rectangle Area using Java Example

Calculate Rectangle Area using Java Example This Calculate Rectangle Area using Java Example shows how to calculate area of Rectangle using it’s length and width.

Output of Calculate Rectangle Area using Java Example would be

 

Continue reading


Calculate Rectangle Perimeter using Java Example

Calculate Rectangle Perimeter using Java Example This Calculate Rectangle Perimeter using Java Example shows how to calculate perimeter of Rectangle using it’s length and width.

Output of Calculate Rectangle Perimeter using Java Example would be

 

Continue reading


Calculate Circle Perimeter using Java Example

Calculate Circle Perimeter using Java Example This Calculate Circle Perimeter using Java Example shows how to calculate Perimeter of circle using it’s radius.

Output of Calculate Circle Perimeter using Java Example would be

 

Continue reading