
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 10483 Articles for Web Development

161 Views
We will be writing a JavaScript program to find the maximum number of zeros placed consecutively at the start and end of any rotation of a binary string. Our program will take a binary string as input and will return the maximum number of zeros that are placed at the start and end in any rotation of the given string. To solve this problem, we will be using string manipulation techniques to manipulate the input string and find the required output. In the next step, we will be rotating the input string and counting the number of zeros placed at ... Read More

493 Views
In JavaScript, the 2D matrix manipulation involves working with arrays of arrays, often to perform operations on rows or columns. In this example, we focus on finding the maximum value in each row of a matrix. Two methods are demonstrated: using nested loops for step-by-step iteration, and using map() with Math.max() for a more concise, functional approach. Both methods return an array of the maximum values from each row, but the map() approach is more efficient and modern. Different approaches Following are the different approaches to finding maximum element of each row in a matrix − ... Read More

608 Views
To find lexicographically minimum string rotation in Javascript, we will understand two different approaches in this article. A lexicographically minimum rotation of a string is the smallest string that can be obtained by rotating the original string any number of times in lexicographical order. By lexicographical order it means dictionary order such as: a < b, ab < ac. In this article we are having a string. Our task is to write a JavaScript program to find lexicographically minimum string rotation. Example Input: bba All lexicographical order are: bba, bab, abb Output: Smallest lexicographical rotation: abb ... Read More

156 Views
We will be using the JavaScript array sort method and slicing technique to find the k maximum elements of an array in their original order. Firstly, we sort the array in descending order, and then slice it from the beginning to the kth index to obtain the k maximum elements. By preserving the original order of the elements, the significance and context of the data remains intact, making it easier for us to analyze and interpret the results. Approach The approach to find k maximum elements of an array in original order can be described as follows − Create ... Read More

559 Views
A subarray with a sum of 0 is a sequence of contiguous elements within an array where the sum of all elements in that sequence equals zero. Identifying such subarrays is a common problem in data analysis and coding challenges. The prefix sum technique efficiently solves this problem. In this article we will find if there is a subarray with 0 sum using JavaScript. Continuously calculate the prefix sum while traversing the array and use a hash map to store sums seen so far. Check if the current prefix sum ... Read More

139 Views
We will be implementing a JavaScript program to find an element at a given index after a number of rotations. This program will require us to perform rotations on an array and then return the element present at the specified index. To accomplish this task, we will be using the modulo operator to calculate the new index after each rotation. The future continuous tense will be used throughout the explanation. In the program, we will be taking the input of the array, the number of rotations, and the index. We will then perform the rotations by using the modulo operator ... Read More

503 Views
To find difference between sums of two diagonals, we will be discussing two different approaches. We will calculate the sum of the elements present in the left and right diagonal, then we will subtract both sum values to get the difference. In this article we are having a square matrix, our task is to write a JavaScript program to find difference between sums of two diagonals. Example Input: Matrix: [[1, 2, 3], [4, 5, 6], [9, 8, 9]] Sum of left diagonal elements = 1+5+9 = 15 Sum of right diagonal elements = 3+5+9 ... Read More

3K+ Views
To find closest number in array using Javascript, we will be understanding and discussing three different approaches. We will also compare time and space complkexities of all the appproaches used. In this article we are having an array and a target value, our task is to find closest number to target value in array using Javascript. User must know about JavaScript arrays, searching alogorithms such as linear and binary search, sorting, loops, and conditional statement. Approaches to Find Closest Number in Array Here is a list of approaches to find closest number in array in JavaScript which we will ... Read More

197 Views
We will write a JavaScript program to find the sum of an array by using bitwise OR after splitting the given array into two halves after K circular shifts. Our program will perform the task by taking an array and an integer K as inputs. First, we will split the array into two halves after performing K circular shifts. Then, we will perform bitwise OR on both the halves to get a new array. Finally, we will find the sum of the new array obtained from the bitwise OR operation. Approach First, perform K circular shifts on the given ... Read More

16K+ Views
In JavaScript, “” represents the empty string, and we can use the null keyword to initialize the string with a null value. If we don’t assign any value to any variable, it is undefined by default. Sometimes, we need to check if the string is empty, undefined, or null while working with the strings. For example, we are taking the details from the users via an HTML form, and users can add an empty string to the input field; we need to validate the input field and show the error message to the users. In this tutorial, we will learn ... Read More