Ravi Ranjan has Published 148 Articles

JavaScript Program for Rotate a Matrix by 180 degrees

Ravi Ranjan

Ravi Ranjan

Updated on 06-Jun-2025 19:13:01

351 Views

To rotate a matrix by 180 degrees, can be achieved using various approaches. We have discussed three different approaches in this article with stepwise explanation of codes and examples. In this article, we are having a 2D square matrix, our task is to write a JavaScript program to rotate a ... Read More

JavaScript Program for Counting sets of 1s and 0s in a binary matrix

Ravi Ranjan

Ravi Ranjan

Updated on 06-Jun-2025 19:12:44

406 Views

Counting sets of 1s and 0s in a binary matrix can be achieved using nested for loop with conditional statement. A binary matrix is a matrix that consists of only two digits as its name suggests and those two digits are 1 and 0. In this article, we are having ... Read More

JavaScript Program for Maximum and Minimum in a Square Matrix

Ravi Ranjan

Ravi Ranjan

Updated on 06-Jun-2025 19:12:09

298 Views

To get maximum and minimum in a Square Matrix in JavaScript, we will be discussing two different approaches, their complexities, and example codes. First approach make use of nested loop while second approach uses Math function. In this article we are having a 2D square matrix, our task is to ... Read More

JavaScript Program for Frequencies of Even and Odd Numbers in a Matrix

Ravi Ranjan

Ravi Ranjan

Updated on 06-Jun-2025 19:11:52

250 Views

To get frequencies of even and odd numbers in a matrix, we will be discussing three different approaches. We will discuss each approach with code examples and solution of the algorithm being used. In this article we are having a 2D matrix, our task is to write a JavaScript program ... Read More

JavaScript Program to Efficiently Compute Sums of Diagonals of a Matrix

Ravi Ranjan

Ravi Ranjan

Updated on 06-Jun-2025 19:11:29

402 Views

To efficiently compute sums of diagonals of a matrix, we will be discussing two different approaches. We will calculate the sum of the elements present in the left-to-right and right-to-left diagonal i.e primary and secondary diagonal respectively. In this article we are having a square matrix, our task is to ... Read More

JavaScript Program for Diagonally Dominant Matrix

Ravi Ranjan

Ravi Ranjan

Updated on 06-Jun-2025 19:11:07

232 Views

Diagonally dominant matrix refers to square matrix having magnitude of diagonal element in a row greater than or equal to the sum of magnitude of non-diagonal elements in that row. In this article we are having a square matrix, our task is to write JavaScript program for diagonally dominant matrix. ... Read More

JavaScript Program for Two Pointers Technique

Ravi Ranjan

Ravi Ranjan

Updated on 06-Jun-2025 12:33:05

2K+ Views

In this article we are given a sorted array, our task is to find if there exists any pair of elements such that their sum is equal to a given number. Users must be familiar with array, loop and nested loops, and if/else statement. Two Pointers Technique Two pointers technique ... Read More

JavaScript Program to Find the Lost Element from a Duplicated Array

Ravi Ranjan

Ravi Ranjan

Updated on 06-Jun-2025 12:25:24

1K+ Views

To find the lost element from a duplicated array in JavaScript, we will be discussing various approaches.Prerequisite to solve this problem requires an understanding of JavaScript arrays, loops, set object and binary search. In this article we are having two arrays where one array is duplicate of other with a ... Read More

C++ Program to Find the peak element of an array using Binary Search approach

Ravi Ranjan

Ravi Ranjan

Updated on 04-Jun-2025 18:42:56

977 Views

The peak element in an array is an element that is greater than its neighbor elements i.e., its left and right element. If the peak element is the starting element, then it should be greater than the next element (second element). If the peak element is the last element, then ... Read More

C++ Program to Find the Minimum element of an Array using Binary Search approach

Ravi Ranjan

Ravi Ranjan

Updated on 04-Jun-2025 16:23:27

286 Views

The binary search works on the divide and conquer principle as it keeps dividing the array into half before searching. For applying the binary search algorithm, the given array should be sorted. Since the array is sorted we do not need to search the minimum ... Read More

Previous 1 ... 5 6 7 8 9 ... 15 Next
Advertisements