## Java | Date format validation using Regex

We use java.util.regex.Pattern.compile(String regex) method which compiles the given regular expression into a pattern. Here regex is the expression to be compiled. filter_none edit close… Read More »

## First element that appears even number of times in an array

Given an array, find the first element that appears even number of times in the array. It returns the element if exists otherwise returns 0.… Read More »

## Java Program for Legendre\’s Conjecture

It says that there is always one prime number between any two consecutive natural number\’s(n = 1, 2, 3, 4, 5, …) square. This is… Read More »

## Java Program for Number of solutions to Modular Equations

Given A and B, the task is to find the number of possible values that X can take such that the given modular equation (A… Read More »

## Java Program for Triangular Matchstick Number

Given a number X which represents the floor of a matchstick pyramid, write a program to print the total number of matchstick required to form… Read More »

## Java Program to Find sum of Series with n-th term as n^2 – (n-1)^2

We are given an integer n and n-th term in a series as expressed below: Tn = n2 – (n-1)2 We need to find Sn… Read More »

## Java Program for Finding the vertex, focus and directrix of a parabola

A set of points on a plain surface that forms a curve such that any point on that curve is equidistant from the focus is… Read More »

## Java Program to find Product of unique prime factors of a number

Given a number n, we need to find the product of all of its unique prime factors. Prime factors: It is basically a factor of… Read More »

## Java Program for Number of jump required of given length to reach a point of form (d, 0) from origin in 2D plane

Given three positive integers a, b and d. You are currently at origin (0, 0) on infinite 2D coordinate plane. You are allowed to jump… Read More »

## Print distinct sorted permutations with duplicates allowed in input

Write a program to print all distinct permutations of a given string in sorted order. Note that the input string may contain duplicate characters. In… Read More »

## Swap corner words and reverse middle characters

Write a Java program to take an input string and exchange the first and last word and revers the middle word. Examples: Input : Hello… Read More »

## Java Program to check whether it is possible to make a divisible by 3 number using all digits in an array

Given an array of integers, the task is to find whether it’s possible to construct an integer using all the digits of these numbers such… Read More »

## Java Program to Find sum of even factors of a number

Given a number n, the task is to find the even factor sum of a number. Examples: Input : 30 Output : 48 Even dividers… Read More »

## Java Program to Check if all digits of a number divide it

Given a number n, find whether all digits of n divide it or not. Examples: Input : 128 Output : Yes 128 % 1 ==… Read More »

## Java Program for Find the perimeter of a cylinder

Given diameter and height, find the perimeter of a cylinder. Perimeter is the length of the outline of a two – dimensional shape. A cylinder… Read More »