What is the Krishnamurthy Number? The Krishnamurthy number is a number which the sum of the factorials of all its digits is equal to the original number. These numbers are also called the Strong number, Special number, and the Peterson number. For example, let's take the number 40585. Now, calculate the sum of the factorials of its digits: 4! + 0! + 5! + 8! + 5!. The sum is equal to 40585. If you compare it with the original number, you can see that both are the same. Here are some other examples of Krishnamurthy numbers, such as 1, 2, ... Read More
What is Insolite Number? An Insolite number is a number if it is divisible by both the addition of squares of each digit and the square of the whole product value of all digits. For example, we have a number 123, first, we need to find the sum of squares of each digit (sum of square = 1^2 + 2^2 + 3^2), and then we have to multiply each digit of the given number (product = 1 x 2 x 3). Now, we have to calculate the square value of the product (product square = (1 x 2 x 3)^2). ... Read More
What is Harshad Number? A Harshad number is an integer that is completely divisible by the sum of its digits, which means that there is no remainder when the number is divided by this sum. For example, consider the number 81. If we calculate the sum of its digits (8 + 1), which is 9. Divide the number 81 by the sum result 9, there will be no remainder, The number 81 is a Harshad number. Here are some other examples of Harshad numbers such as 1, 2, 4, 5, 6, 7, 8, 9, 10, 12, 18, 20, etc. In ... Read More
In this article, we will learn how to parse for words in a string for a specific word in Java, i.e., we need to check if a specific word exists in a string, and if it does, we will parse the string to find that word. There are various methods in Java that you can use to parse a string for a specific word. Here we are going to discuss 3 of them. Using the contains() method Using the indexOf() method Using the StringTokenizer class Using ... Read More
Linear Search on a Java Array using RecursivelyLinear search is an algorithm that we use to check if an element is present in an array or not. It checks all the elements of the array one by one until it finds the element or reaches the end of the array. Recursion is a way where a function calls itself to solve a certain problem until it reaches a base case. In this article, we will understand how to recursively linearly search an element in an array. Let's see an example: Input: int [] arr = {1, 2, 3, 4, 5}; ... Read More
Jackson is a Java-based library, and it can be useful for converting Java objects to JSON and JSON to Java objects. A Jackson API is faster than other API, needs less memory, and is good for large objects. We can convert a JSON array to a list using the ObjectMapper class. It has a useful method, readValue(), which takes a JSON string and converts it to the object class specified in the second argument. Before proceeding further, first of all, we need to import the Jackson library into our project. To do this, you can add the following dependency to ... Read More
What is a Sparse Matrix? A matrix is said to be a sparse matrix if most of the elements of that matrix are 0. It means that the number of non-zero elements has a lesser count than the number of zero elements.Let's say we have a matrix of size 3*3, which means it has 9 elements. If 5 or more of those elements are 0, then we can say that the matrix is sparse. A = [ 0 2 0 ] [ 0 5 4 ] [ 0 0 0 ] ... Read More
In Java, a list is a collection that we use for storing elements. In many cases, we need to get the length of a list of lists. In this article, we will learn how to get the length of a list of lists in Java. List provides a method size() to get the count of elements present in the current list. To get the size of each list, we can iterate through each item in the list and add its size to get the count of all elements present in the list of lists. Ways to Get the Length of ... Read More
A List is a Collection in Java that is used for storing elements in sequence. In this article, we will be learning how to create a list with values in Java. Ways to Create a List with Values in Java There are various ways to create a list with values in Java. Below are the different approaches: Using Arrays.asList() method Using Stream.of() method Using List.of() method Using Arrays.asList() method The Arrays.asList() method returns the elements of the current array in the form of a List. This method ... Read More
In Python, duplicates of an existing file are created as backups to manipulate data and to preserve original version. To create a duplicate file of an existing file using Python we can use the shutil module or pathlib module, which we will discuss in detail with examples. Here are the various approaches for this: Creating Duplicate File of an Existing File Using shutil Module Creating Duplicate File of an Existing File Using open() Function Creating Duplicate File of an Existing File Using pathlib Creating Duplicate File ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP