[Solved] How to check if two String are Anagram in Java? Example

Hello guys, if you are preparing for Coding interviews then you already know that String is one of the most popular topics. You will be bound to get some string-based coding problems on interviews. If not, you have come to the right place becuase we'll look at one of the most popular String programming interview questions today,  how to check if two given strings are Anagram of each other? Two String is said to be an anagram of each other, if they contain exactly the same characters but in a different order. For example "ARMY" and "MARY" are an anagram of each other because they contain the exact same characters 'A', 'R', 'M' and  'Y'.

Top 6 Dynamic Programming Online Courses for Coding Interviews in 2025 - Best of Lot

Hello guys, if you are preparing for a coding interview but struggling to solve Dynamic programing based coding problems and looking for the best resource to improve your Dynamic programming skill then you have come to the right place. Earlier, I have shared the best coding interview courses and best Recursion courses,  as well as popular  Dynamic programming problems from interviews, and today I am going to share the best online courses to learn Dynamic programming in depth.  Dynamic programming simply means that plain recursion can be optimized when there are repeated calls for some inputs.

[Solved] How to Find Repeated Characters in a given String with count in Java? Example

This is another interesting coding problem or programming exercise for beginner programmers. How do you find repeated or duplicate characters in a given String and their count? You can solve this coding problem in any programming language of your choice like Java, Python, Ruby, or even JavaScript. I'll explain the logic and solution which is easy to implement in the above programming languages and I'll provide code in Java, which is my favorite programming language.  In order to solve this problem, You need to first check if a String contains any duplicate characters or not, and then if it contains any duplicate letters then find out how many times they appear in the given input String.

How to solve Two Sum Array Problem in Java? Example

Hello guys, if you have been solving data structure and algorithms problems or been through a couple of coding interviews then you might be familiar with the classical "Two Sum" problem. It's one of the classical coding problems of finding two numbers in a given array whose sum is equal to a given target number. It's a good problem to learn how array data structure works and programming basics like loops, conditionals, and operators. It's also good for developing your problem-solving skills and coding sense, which will help you in the long run. This is also a popular Leetcode problem and is commonly asked in coding interviews to both beginners and intermediate programmers.

Java Program to find Armstrong numbers with Example

Armstrong number Example in Java
How to check if a number is an Armstrong number or not? or write a Java program to find Armstrong's number? This is a common Java interview question asked on-campus interviews and fresher-level interviews. This is also a popular Java programming exercise on various schools, colleges, and computer courses to build programming logic among Students. An Armstrong number is a 3 digit number for which the sum of cube of its digits is equal to the number itself. 

How to Find Missing Number in a Sorted Array in Java [Solved]

Today's coding problem is not very new, it's an age-old classic Programming interview Question. You have a sorted array containing n - 1 unique number starting from 0 to n - 1. There is only one number missing in this range and you need to find that out. I mean you need to write a Java method to find the missing number and print its value in the console. Some of you might have seen this question before, but if you have not been asked this question before, what is the first approach comes into your mind to solve this question? Since only one number is missing, many programmers come up with the approach of iterating over the array, and comparing each element with the expected one like the first element should be 0, the second element should be 1, and so on.

How to check if strings are rotations of each other in Java? String Rotation Example Solution

String-based algorithmic questions are very popular in Java interviews e.g. checking if two String is the anagram of each other (see), or checking if given String is a palindrome (see), or just finding permutations of given String (see). One of such popular String-based interview questions is about to check if two Strings are a rotation of each other in Java. In order to solve this question, you should know what is String rotation? Well, A string is made of characters and you just rotate the String around any character like "programming" will become "ingprogramm" if we rotate the String on the trailing character 3 times.

How to check if Array contains given Number or String in Java [ Linear Search vs Binary Search]

Hello guys, one of the common coding questions from Java interviews is how to test if an Array contains a certain value or not? This is a simple question, but sometimes interview pressure makes candidates nervous. In this article, you'll learn how to solve this problem using different approaches. Since an array in Java doesn't have any inbuilt method for searching values, interviewers prefer to ask this question, to see how a candidate deals with such a situation. If you have good knowledge of Java API, then you will immediately come to know that there are alternatives available like using the binarySearch() method of Java Java .util.Arrays class or taking advantage of ArrayList contains method by first converting your array to ArrayList.

10 Books and Courses to Prepare Technical Programming/Coding Job Interviews in 2025

If you are preparing for a technical interview in the software development sector and looking for some great books to boost your preparation, then you have come to the right place. In the past, I have hared some of the best online courses to prepare coding interviews. In this article, I am going to share some of the best programming/coding interview books to prepare well for any software development jobs. These books are enough to crack even the toughest of the job interviews at GoogleAmazon, or Microsoft. They provide excellent coverage of all essential topics for programming job interviews like data structure and algorithms, system design, algorithm design, computer science fundamentals, SQL, Linux, Java, Networking, etc.

How to Reverse words in String Java? [Solution]

Hello guys, if you are wondering how to reverse words in a given String in Java then you have come to the right place. Earlier, I have shared 75 Programming interview questions and In this Java Coding tutorial, you will learn how to reverse words in String. It's also one of the popular coding questions, so you will also learn how to take a requirement, how to fill gaps in the requirement by asking the right question. A String is nothing but a sentence, which may contain multiple works, or just contain a single word or it may be empty. Your program must produce a String that contains the word in reverse order, for example, if the given input is "Java is Great" then your program should return "Great is Java".  

[Solved] How to remove duplicate elements from Array in Java? Example

This is one of the common technical interview questions which are asked to entry-level programmers and software engineers. There are also a lot of variants of how do you remove duplicates from an array in Java, like sometimes the array is sorted, and other times it's not sorted or unsorted. Sometimes, the Interviewer just spends more than half of the interview on this question by progressively making it more difficult by imposing new constraints like removing duplicate elements in place or without using any additional data structure, etc.

[Solved] How to Print Alphabets in Upper and Lower Case in Java? Example Tutorial

Hello guys, if you are learning Java and looking for basic programming exercise to build your concepts then you have come to the right place. Earlier, I have shared 15 common Java programming exercises and today, you will learn one of them. One of the textbook exercises to get started with any programming language is writing a program to print alphabets in both upper and lower case. This program allows you to explore the String class in Java with the toUpperCase() and toLowerCase() method but normally when you start, it's asked to do this without any API methods.

How to swap two Integers without using a temporary variable in Java? [Solution]

One of the oldest trick questions from a programming interview is, How do you swap two integers without using a temp variable? This was first asked to me on a C/C++ interview and then several times on various Java interviews. The beauty of this question lies both in the trick to thinking about how you can swap two numbers without the third variable, but also problems associated with each approach. If a programmer can think about integer overflow and consider that in its solution then it creates a very good impression in the eye of interviewers.

How to Print Floyd's Triangle in Java - Example Tutorial

Hello guys, In the last article, I have taught you how to print Pascal's triangle and in today's article, I'll teach you how to print Floyd's triangle in the Java program. Floyd's triangle is easier to print than Pascal's triangle because you don't need to take care of formatting the numbers as Floyd's triangle is a right-angle triangle. It is named after American computer scientist Robert Floyd, who has also contributed Floyd–Warshall algorithm, which efficiently finds all shortest paths in a graph, and Floyd's cycle-finding algorithm for detecting cycles in a sequence. 

Matrix Multiplication in Java using Scanner, Class, and Function [Example]

Hello guys, if you are looking for a matrix multiplication example in Java using the scanner for user input, and using class and object-oriented programming then you have come to the right place. In this Java tutorial, I will show you how to multiply matrix in Java using an array, scanner, and object-oriented programming. We will create a class to represent matrix and then define a multiplication method to multiply two matrices in Java. I first learned about matrix in class 12th and I first wrote the program to multiply two matrices on my first semester of engineering, so, when I thought about this program, It brings a lot of memories from the past. 

How to check is given String is a Palindrome in Java using Recursion

In this tutorial, you will learn how to check if a string is a palindrome in Java using Recursion. A String is nothing but a collection of characters like "Java," and String literals are encoded in double-quotes in Java. A String is said to be a palindrome if the reverse of String is equal to itself like "aba" is a palindrome because the opposite of "aba" is also "aba", but "abc" is not a palindrome because the reverse of "abc" is "cba" which is not equal. Recursion means solving a problem by writing a function which calls itself. In order to check if String is a palindrome in Java, we need a function that can reverse the String.

How to Reverse String in Java with or without StringBuffer Example

Reverse String in Java
There are many ways to reverse a given String in Java. For example, you can use rich Java API to quickly reverse the contents of any String object. Java library provides StringBuffer and StringBuilder class with the reverse() method which can be used to reverse String in Java. Since converting between String and StringBuffer or StringBuilder is very easy it's the easiest way available to reverse String in Java. But, in a coding interview, you may not be allowed to use the JDK API methods to solve this problem. That's why, writing a Java program to reverse String in Java without StringBuffer is one of the popular Java String interview questions, which requires you to reverse String by applying logic and by not using API methods.

How to Remove all adjacent duplicates characters from String in java? Example Tutorial

Hello guys, if you are wondering how to remove adjacent repeated characters or duplicates from a given String in Java then you have come to the right place. In the last article, we have seen how to find duplicate characters as well as how to remove duplicate characters from String in Java, and in this article, we will take that topic to another level and remove adjacent duplicates from given String. This topic gives another perspective to removing duplicates in a word or phrase. Probably before now, you are familiar with removing duplicates from a word or phrase, or number. But this topic gives a detailed understanding of how to remove adjacent duplicates. 

How to Perform Binary Tree InOrder traversal in Java using Recursion? Example Tutorial

The InOrder traversal is one of the three popular ways to traverse a binary tree data structure, the other two being the preOrder and postOrder. During the in-order traversal algorithm, the left subtree is explored first, followed by root, and finally nodes on the right subtree. You start traversal from root then go to the left node, then again go to the left node until you reach a leaf node. At that point in time, you print the value of the node or mark it visited and move to the right subtree. Continuing the same algorithm until all nodes of the binary tree are visited. The InOrder traversal is also known as the left-node-right or left-root-right traversal or LNR traversal algorithm.

How to Find Square Root of a Number in Java [Solved] - Example Tutorial

Java program for a square root or a number in Java
How to write a Java program to find the square root of a number is a common Java programming exercise that many institutes use in their Java course along with Java program to print Fibonacci series and How to find Armstrong numbers in Java, which we have seen earlier.  Java program for the square root is also a popular question during college semester exams and various programming tests.