#
java programs Archive

In this post, we will see how to print the following pyramid pattern. Problem Input : n = 4 Output : 1 3*2 4*5*6 10*9*8*7Input : n = 5 Output : 1 3*2 4*5*6 10*9*8*7 …

In this post, we will see how to check if array elements are consecutive. Problem Given an array, we need to check if array contains consecutive elements. For example: Input: array = {5, 3, 4, …

In this tutorial, we will see Find Longest Substring Without Repeating Characters in java. Problem We need to find Longest Substring Without Repeating Characters Solution Brute force solution Find all the substring and check the …

In this tutorial, we will see java program to find permutation and combination. Permutation is represented as nPr and Combination is represented as nCr.It is simple program which involves factorial of the numbers. Here is …

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 …