Prabhdeep Singh has Published 161 Articles

JavaScript Program for Finding Length of a Linked List

Prabhdeep Singh

Prabhdeep Singh

Updated on 20-Jan-2025 17:41:36

572 Views

To find the length of a linked list in JavaScript, we need to count how many nodes are present. A linked list is made up of nodes, where each node contains data and a reference to the next node. The length is determined by starting at the head and counting ... Read More

JavaScript Program for Inserting a Node in a Linked List

Prabhdeep Singh

Prabhdeep Singh

Updated on 17-Jan-2025 11:01:37

1K+ Views

To insert a node in a linked list using JavaScript, how can we do it? A linked list consists of nodes, each storing data and a reference to the next node. We can insert a new node at various positions: the beginning, a specific position, or the end of the ... Read More

JavaScript Program to Cyclically Rotate an Array by One

Prabhdeep Singh

Prabhdeep Singh

Updated on 10-Jan-2025 10:35:20

526 Views

To cyclically rotate an array by one means shifting the value present at each index to their left or right by one. In this article, we are having an array and our task is to write a JavaScript program to cyclically rotate an array by one. Users must be familiar ... Read More

JavaScript Program for Finding Intersection Point of Two Linked Lists

Prabhdeep Singh

Prabhdeep Singh

Updated on 27-Dec-2024 19:17:04

300 Views

In this tutorial, we will discuss two approaches to finding the intersection point of two linked lists in JavaScript. The first approach involves using the loops, and the second approach involves using the difference of nodes technique which works in the linear time. We will be given two linked lists ... Read More

JavaScript Program for the Last duplicate element in a Sorted Array

Prabhdeep Singh

Prabhdeep Singh

Updated on 27-Dec-2024 19:16:44

474 Views

In this article, we are going to explore a Javascript program that works with a sorted array containing duplicate elements. The task is to traverse the array using a loop and identify both the index of the last duplicate element and the duplicate number.  Introduction to Problem In the given problem ... Read More

JavaScript Program to Check if a Given Matrix is Sparse or Not

Prabhdeep Singh

Prabhdeep Singh

Updated on 15-Dec-2024 16:29:10

338 Views

To check if a given matrix is sparse or not, we will be discussing two different approaches, their complexities, and example codes. A sparse matrix is a special type of matrix in which the number of zeroes is strictly more than half of the the total number of elements present ... Read More

JavaScript Program to Check if a Matrix is Symmetric

Prabhdeep Singh

Prabhdeep Singh

Updated on 12-Dec-2024 12:22:52

749 Views

To check if a matrix is symmetric, we simply check if the matrix and it's corresponding transpose matrix are equal. A symmetric matrix is a special case of a matrix where both the matrix and the transpose of the matrix are the same (A = A^T). In this article we ... Read More

JavaScript Program for Products of ranges in an array

Prabhdeep Singh

Prabhdeep Singh

Updated on 04-Dec-2024 22:05:47

280 Views

We will be given an array and we have to answer some queries related to the given range that is from a given starting index to the ending point or index we have to return the product of the elements in that range. We will see some approaches in this ... Read More

Java program to find longest common prefix using word by word matching

Prabhdeep Singh

Prabhdeep Singh

Updated on 29-Sep-2024 02:50:52

1K+ Views

In this article, we will explore how to find the longest common prefix among a given set of strings using two different approaches in Java. We will first discuss an approach that compares all strings directly to find the longest prefix and then move to a word-by-word matching approach.  Problem ... Read More

Java program to find length of the longest substring without repeating characters

Prabhdeep Singh

Prabhdeep Singh

Updated on 24-Jul-2024 11:43:39

2K+ Views

In Java, substrings are part of the string which contains the continuous character of the string of any length from 1 to complete string. We are given a string and we have to find the length of the largest substring from the given string that only contains the unique characters. ... Read More

1 2 3 4 5 ... 17 Next
Advertisements