Prabhdeep Singh has Published 188 Articles

JavaScript Program to check idempotent matrix

Prabhdeep Singh

Prabhdeep Singh

Updated on 20-Apr-2023 17:16:20

177 Views

An idempotent matrix is a square matrix that has the same number of rows and columns and when we multiply the matrix by itself the result will be equal to the same matrix. We will be given a matrix and we have to find that whether it is an idempotent ... Read More

JavaScript Program for Range sum queries for anticlockwise rotations of Array by K indices

Prabhdeep Singh

Prabhdeep Singh

Updated on 14-Apr-2023 17:15:00

210 Views

Anticlockwise rotation of an array means rotating all the elements of the given array to their left side by the given number of indexes. In this article, we will implement a JavaScript program for range sum queries for anticlockwise rotations of the array by k indices. Introduction to Problem In ... Read More

JavaScript Program for Range LCM Queries

Prabhdeep Singh

Prabhdeep Singh

Updated on 14-Apr-2023 17:11:10

183 Views

LCM stands for the lowest common multiple and the LCM of a set of numbers is the lowest number among all the numbers which are divisible by all the numbers present in the given set. We will see the complete code with an explanation for the given problem. In this ... Read More

JavaScript Program for Quicksort On Singly Linked List

Prabhdeep Singh

Prabhdeep Singh

Updated on 14-Apr-2023 17:10:12

330 Views

The Singly-linked list is a linear data structure that consists of nodes. Each node contains the data and the pointer to the next node which contains the memory address of the next node because the memory assigned to each node is not continuous. Sorting is a technique by which we ... Read More

JavaScript Program for Queries to find the maximum sum of contiguous subarrays of a given length in a rotating array

Prabhdeep Singh

Prabhdeep Singh

Updated on 14-Apr-2023 17:08:08

188 Views

Rotating array means we will be given a number and we have to move the elements of the array in cyclic order in either the right or left direction. Here we are not specified so we will use the right rotation as the standard and after the given number of ... Read More

JavaScript Program for Queries for rotation and Kth character of the given string in constant time

Prabhdeep Singh

Prabhdeep Singh

Updated on 14-Apr-2023 17:06:10

216 Views

Rotation of the given string means moving the characters of the given string in clockwise or anticlockwise manner by some indexes. Here, we will implement a JavaScript program for queries for rotation and kth character of the given string in the constant time. In this article we will implement the ... Read More

JavaScript Program for Printing Reverse of a Linked List Without Actually Reversing

Prabhdeep Singh

Prabhdeep Singh

Updated on 14-Apr-2023 17:03:55

208 Views

Linked lists are linear data structures with their memory not being in a consecutive manner. We will write a complete code in JavaScript with different approaches and examples to understand the process better. Introduction to Problem In the given problem, we are given a linked list and we have to ... Read More

JavaScript Program for Print all triplets in sorted array that form AP

Prabhdeep Singh

Prabhdeep Singh

Updated on 14-Apr-2023 17:01:10

217 Views

AP is the arithmetic progression in which the difference between two consecutive elements is always the same. We will print all the triplet in a sorted array that form AP using three approaches: Naive approach, binary search method and two-pointer approach. Introduction to Problem In this problem we are given ... Read More

JavaScript Program for Maximum equilibrium sum in an array

Prabhdeep Singh

Prabhdeep Singh

Updated on 14-Apr-2023 16:58:46

1K+ Views

The equilibrium sum of the given array is the sum at a particular point or index of the array after which the subarray has the total sum equal to the sum of the subarray starting from the 0th index to the current index (including the current index). We will see ... Read More

JavaScript Program for Maximum difference between groups of size two

Prabhdeep Singh

Prabhdeep Singh

Updated on 14-Apr-2023 16:58:02

128 Views

In this program, we are given an array of integers of even length as we know here we have to make groups of two. We have from that groups using elements of an array, we have to choose two groups among them in order to find the maximum difference between ... Read More

Advertisements