Write a java program to check anagram. In this programming question, we are going to write a java code to check whether two strings are anagrams of each other.
Let’s first understand what is an anagram? and how we are going to solve this problem.
What is an Anagram?
Two strings are said to be anagrams of each other if it contains the same characters, only the order of characters in both the strings is different. In other words, both strings must contain the same exact letters in the same exact frequency.
Write a Java program to check prime number. Given an input integer, We have to write an efficient code to check whether a number is prime or not.
Before writing a program, let’s quickly understand what is a prime number.
A prime number is a number that is greater than 1 and it has no positive divisors other than 1 and itself.
For example – 3, 13, 7 is a prime number, as it’s divisible by 1 and itself. Similarly, 29, 19 etc. are also prime numbers.
6 is not a prime number as it’s divisible by 1, 2, 3 and 6.
2 is the only even prime number.
How to check whether a number is prime or not in Java
Write a java program to print Fibonacci series up to N number, where N is the input integer.
Write a program to print 1 to 100 numbers without using loop. Using loop, (for and while loop) we can easily solve this problem. Think for a moment how do you solve this problem without using a loop. We can solve this problem using recursion.
Write a java program to find duplicate elements in an array. There are multiple ways through which we can find duplicate elements in an array. In this tutorial, I’ll discuss three ways to find duplicate elements in an array.
This question is also very important in terms of technical interviews.