Prabhdeep Singh has Published 197 Articles

JavaScript Program for Program to cyclically rotate an array by one

Prabhdeep Singh

Prabhdeep Singh

Updated on 14-Apr-2023 17:05:38

208 Views

Cyclic rotation means shifting the value present at each index to their left or right by one and for one corner it takes the value present at the other corner. For the left rotation the value present at the first index will go at the last index and for all ... Read More

JavaScript Program for Products of ranges in an array

Prabhdeep Singh

Prabhdeep Singh

Updated on 14-Apr-2023 17:04:44

113 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

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

Prabhdeep Singh

Prabhdeep Singh

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

105 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

76 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

784 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

52 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

JavaScript Program for Finding Intersection Point of Two Linked Lists

Prabhdeep Singh

Prabhdeep Singh

Updated on 14-Apr-2023 16:52:10

139 Views

In this tutorial, we will discuss two approaches to find the intersection point of two linked lists. 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 that are ... Read More

JavaScript Program to Check if Matrix is Upper Triangular

Prabhdeep Singh

Prabhdeep Singh

Updated on 13-Apr-2023 15:31:41

77 Views

An Upper triangular matrix is a squared matrix that has the same number of rows and columns and all the elements that are present below the main diagonal passing from the first cell (present at the top-left) towards the last cell (present at the bottom-right) are zero. Upper triangular means ... Read More

JavaScript Program to check if the matrix is lower Triangular

Prabhdeep Singh

Prabhdeep Singh

Updated on 13-Apr-2023 15:30:14

57 Views

A matrix can be defined as a 2D array that stores elements in it and mathematically it stores the numbers in it. A Lower triangular matrix is a squared matrix that has the same number of rows and columns and all the elements that are present above the main diagonal ... Read More

JavaScript Program to Check if it is possible to sort the array after rotating it

Prabhdeep Singh

Prabhdeep Singh

Updated on 13-Apr-2023 15:28:38

48 Views

Rotating an array means moving the elements of each index (excluding one end ) to the following index for the right rotation and the previous index for the left rotation. For the right rotation zeroth index takes the value of the last index and vice-versa for the left rotation. Sort ... Read More

Advertisements