Web Development Articles

Page 122 of 801

JavaScript Program to Check horizontal and vertical symmetry in binary matrix

Alshifa Hasnain
Alshifa Hasnain
Updated on 15-Mar-2026 583 Views

In this article, we will learn to create a program to check both horizontal and vertical symmetry in a binary matrix in JavaScript. A binary matrix is a 2-D array that consists of one and zero only as the elements in each cell. Horizontal symmetry of a binary matrix means if the first row is the same as the last row, the second row is the same as the second last row, and so on. What are Symmetry Matrices? Symmetry in matrices refers to how the values in the matrix mirror themselves along an axis. In the ...

Read More

JavaScript Program to Cyclically Rotate an Array by One

Prabhdeep Singh
Prabhdeep Singh
Updated on 15-Mar-2026 568 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 with JavaScript loops and array operations. Original Array: 1 2 3 ...

Read More

JavaScript Program for Inserting a Node in a Linked List

Prabhdeep Singh
Prabhdeep Singh
Updated on 15-Mar-2026 1K+ Views

A linked list is a linear data structure where elements (nodes) are stored in sequence, with each node containing data and a reference to the next node. Unlike arrays, linked lists allow efficient insertion and deletion at any position without shifting elements. In this article, we'll explore how to insert nodes into a linked list using JavaScript, covering insertion at the beginning, specific positions, and the end of the list. Basic Node Structure First, let's define a simple Node class that represents each element in our linked list: class Node { ...

Read More

JavaScript Program for Finding Length of a Linked List

Prabhdeep Singh
Prabhdeep Singh
Updated on 15-Mar-2026 628 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 each node until the end of the list. If the list is empty, the length should be 0. Our task is to write a JavaScript program that calculates the length of a linked list. In other words, we need to find out how many nodes are in the list. ...

Read More

JavaScript Program for Equilibrium Index of an Array

Saurabh Anand
Saurabh Anand
Updated on 15-Mar-2026 904 Views

To write a JavaScript program for equilibrium index of an array, we are going to discuss three different approaches with detailed explanation and example codes. The equilibrium index of an array is the position where the sum of the elements to its left and right equals one another. In this article we are having an array of integers, our task is to write a JavaScript program for equilibrium index of an array. Example Input: arr = [-7, 1, 5, 2, -4, 3, 0] Output: Equilibrium index: 3 At index 3, left sum = -7 ...

Read More

JavaScript Program for Two Pointers Technique

Ravi Ranjan
Ravi Ranjan
Updated on 15-Mar-2026 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 is a commonly used algorithmic approach to solve various problems that require linear time complexity. This technique is used to find a solution for problems that involve searching, sorting, or manipulating arrays, strings, or linked lists. In this article, we are going to solve the pair sum problem using ...

Read More

JavaScript Program for the Third Largest Element in an Array of Distinct Elements

Ravi Ranjan
Ravi Ranjan
Updated on 15-Mar-2026 963 Views

For the third largest element in an array of distinct elements, we will discuss three different approaches. We will improve efficiency with each approach and discuss their complexities. In this article we are having an array of distinct elements, our task is to find third largest element in an array of distinct elements in Javascript. Users must be familiar with array, loops and conditional statement. Problem Statement Given an array of distinct elements, we need to find the third largest element efficiently. Input: arr = [2, 5, 8, 1, 4, 10, 7] => Highest: 10, ...

Read More

JavaScript Program for Mirror of Matrix Across Diagonal

Ravi Ranjan
Ravi Ranjan
Updated on 15-Mar-2026 527 Views

To write a javascript program for mirror of matrix across diagonal, we will be discussing two approaches with their code examples and explanations. In this article we have a 2D matrix. Our task is to write a JavaScript program that creates a mirror of the matrix across its diagonal. This operation is also known as matrix transpose, where rows become columns and columns become rows. ...

Read More

JavaScript Program for Rotate a Matrix by 180 degrees

Ravi Ranjan
Ravi Ranjan
Updated on 15-Mar-2026 488 Views

To rotate a matrix by 180 degrees, we can achieve this using various approaches. In this article, we'll explore three different methods with step-by-step explanations and complete examples. A 180-degree rotation of a matrix means that the first row becomes the last row in reverse order, the second row becomes the second-to-last row in reverse order, and so on. Essentially, we're flipping the matrix both horizontally and vertically. Example Input: matrix = [[1, 2, 3, 4], [5, 6, 7, 8], ...

Read More

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

Ravi Ranjan
Ravi Ranjan
Updated on 15-Mar-2026 354 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 for frequencies of even and odd numbers in a matrix. Users must be familiar with conditional statement, nested loops and javascript operators. Example Input: Matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]; Even numbers: {2, 4, 6, 8} Odd numbers: {1, 3, ...

Read More
Showing 1211–1220 of 8,010 articles
« Prev 1 120 121 122 123 124 801 Next »
Advertisements