#
java programs Archive

In this post, we will see how to reverse a number in java. Here is simple program to reverse a number. Output: Enter a Number : 4567 Reverse of the number : 7654 Let’s …

In this post, we will see about linear search in java. Linear search is simple sequential search in which target element is searched one by one in the array. If element is found in the …

In this post, we will see Java program to find number of words in a String. Problem Find the number of words in a String. For example: There are 6 words in below String welcome …

Kadane algorithm is a famous algorithm to solve maximum subarray problem. Maximum subArray problem: From Wikipedia : In computer science, the maximum subarray problem is the task of finding the contiguous subarray within a one-dimensional …

If you want to practice data structure and algorithm programs, you can go through data structure and algorithm interview questions. In this post, we will see how to check for balanced parentheses in an expression. Lets …

In this post, we will see how to remove all white spaces from String in java. There are multiple ways to remove spaces from String. Using ReplaceAll Using Iteration Using ReplaceAll : You can simply …

Fibonacci series is numerical series in which next number is sum of previous two numbers. For example : 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 etc. There are two ways to …

Armstrong number is a 3 digit number which is equal to sum of cube of its digits. For example: 371,153 In this post, we will see how to check for Armstrong number in java. …

In this post, we will see how to swap two numbers without using temporary variables. There are three ways to do it. Java program: When you run above program, you will get following output: …

In this post, we will see how to find Greatest common divisor(GCD) and Least Common Multiple(LCM) in java. GCD is calculated using Euclidean algorithm and LCM is calculated using reduction by GCD Eucid algo for …