Found 8895 Articles for Front End Technology

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

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

102 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 rotations, we will return the subarrays with the maximum sum. We will see the code with the proper explanation in the article. Introduction to Problem In this problem, we are given an array that contains the integers and another array that contains the pairs of queries. Each index of the ... Read More

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

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

102 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 proper code and explain each step. Introduction to Problem In the given problem, we are given by a string which contains some characters in it. We are given by some limited queries and each query contains two numbers or integers. First integer represents the number of times we have to ... Read More

JavaScript Program for Program to cyclically rotate an array by one

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

222 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 indexes takes the value present at the index which is present after them. In the right rotation, the thing is exactly the opposite to the left rotation. In this article, we will see the proper code with implementation to perform the rotations on the array. Introduction to Problem In the ... Read More

JavaScript Program for Products of ranges in an array

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

121 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 article to implement the above problem in JavaScript with the explanation. Introduction to Problem We are given an array and some queries, in each query we will be given some ranges by indicating the first and the last index of the range and we have to answer the product of ... Read More

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

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

116 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 print all of its elements in reverse order, but we don’t have to reverse the given linked list. For example − Given linked list: 1 2 3 4 5 6 Result: 6 5 4 3 2 1 We will use two methods to print the given linked list ... Read More

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

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

89 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 by a sorted array meaning all the elements are in the increasing form. We have to find the three elements which are part of the array and form an AP. For example − Given array: 1 5 2 4 3 From the given array we have two triplets: 1 2 ... Read More

JavaScript Program for Maximum equilibrium sum in an array

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

860 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 the examples and the code implementations in JavaScrript with the different approaches. Introduction to Problem We are given a single array in which we have to find a point from which the total sum of the elements that are present on the left side (including the current index element) is ... Read More

JavaScript Program for Maximum difference between groups of size two

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

64 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 that two groups and we have to return that maximum difference which is going to see in the article below. Introduction to Problem In the given problem we have to find the Maximum difference between groups of size two. It means we have given an array of even length and ... Read More

JavaScript Program for Finding Intersection Point of Two Linked Lists

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

155 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 not sorted. Note that there is another version of this problem in which we are given a sorted pair of linked lists and have to find the intersection. We have to find the elements after which all the elements in both linked lists are same. We will provide a proper ... Read More

As a developer, how much do you use JavaScript?

Kalyan Mishra
Updated on 14-Apr-2023 16:50:55

95 Views

JavaScript is an object oriented, interpreted scripting language. It’s basically a client-side scripting language which is used to develop dynamic and interactive websites. As you know html used to add elements on the web page whereas CSS is used to make its beautification and JavaScript used to add functionalities like interactivity, animation. JavaScript is also used in the development of mobile application, server-side implementation, game development. We can also use JavaScript with other front-end frameworks like ReactJS, AngularJS, Vue.js. Using these frameworks and libraries developers can easily create dynamic web application and complex designs. In the Full-stack development JavaScript used ... Read More

Advertisements