AmitDiwan has Published 10744 Articles

Java Program for focal length of a spherical mirror

AmitDiwan

AmitDiwan

Updated on 23-Dec-2024 11:17:56

284 Views

In this article, we will learn two different approaches to computing the focal length of a spherical mirror using Java. While the second method makes use of Object-Oriented Programming (OOP) concepts for a more generic and flexible approach the first method is a simple functional implementation. Finding Focal Length Spherical ... Read More

JavaScript program to access browsing history

AmitDiwan

AmitDiwan

Updated on 23-Dec-2024 11:17:25

655 Views

In this article, we will learn to access browsing history using Javascript. In web development, accessing a user’s browsing history can improve user experience and provide personalized content. However, due to privacy concerns and security reasons, modern web browsers limit the amount of browsing history accessible via JavaScript.  What is ... Read More

Java program to split and join a string

AmitDiwan

AmitDiwan

Updated on 17-Dec-2024 23:02:34

5K+ Views

Splitting and join a string To split and join a string in Java, use the split() and join() method as in the below example − Example A class named 'Demo' contains the main function. Here a String object is defined and split based on the '_' value up to the ... Read More

JavaScript Program to Find Difference Between Sums of Two Diagonals

AmitDiwan

AmitDiwan

Updated on 12-Dec-2024 16:40:26

497 Views

To find difference between sums of two diagonals, we will be discussing two different approaches. We will calculate the sum of the elements present in the left and right diagonal, then we will subtract both sum values to get the difference. In this article we are having a square matrix, ... Read More

Generate all combinations of supplied words in JavaScript

AmitDiwan

AmitDiwan

Updated on 11-Dec-2024 11:34:22

1K+ Views

In JavaScript, there are scenarios where you may need to generate every possible combination of a string's characters. This can be especially useful in areas like cryptography, analyzing subsets of data, or solving problems involving permutations. In this article, we’ll learn to implement a JavaScript function to achieve this task. ... Read More

Java program to find minimum sum of factors of a number

AmitDiwan

AmitDiwan

Updated on 09-Dec-2024 21:56:39

450 Views

In mathematics, the factors of a number are the integers that divide the number without leaving a remainder. For a given number, finding the minimum sum of its factors involves identifying a pair of factors whose sum is the smallest among all possible factor pairs. In this article, we will ... Read More

JavaScript program to find maximum element of each row in a matrix

AmitDiwan

AmitDiwan

Updated on 06-Dec-2024 01:42:02

487 Views

In JavaScript, the 2D matrix manipulation involves working with arrays of arrays, often to perform operations on rows or columns. In this example, we focus on finding the maximum value in each row of a matrix. Two methods are demonstrated: using nested loops for step-by-step iteration, and using map() with ... Read More

JavaScript reduce sum array with undefined values

AmitDiwan

AmitDiwan

Updated on 06-Dec-2024 01:41:22

876 Views

If you’re working with arrays in JavaScript, you may encounter situations where your array contains undefined values. This can happen when you're processing data from various sources or working with incomplete datasets. One common problem developers face is summing the values of an array with undefined elements. JavaScript’s reduce() method ... Read More

JavaScript - Redirect a URL

AmitDiwan

AmitDiwan

Updated on 06-Dec-2024 01:40:50

614 Views

In JavaScript, redirecting a user from one URL to another is a straightforward task. There are multiple ways to achieve this, but we’ll focus on two of the most common and effective methods: window.location.href and window.location.replace(). Both are widely used for different purposes, and understanding when to use each one ... Read More

JavaScript Program to Find Closest Number in Array

AmitDiwan

AmitDiwan

Updated on 05-Dec-2024 15:09:54

3K+ Views

To find closest number in array using Javascript, we will be understanding and discussing three different approaches. We will also compare time and space complkexities of all the appproaches used. In this article we are having an array and a target value, our task is to find closest number to ... Read More

Advertisements