Nikitasha Shrivastava

Nikitasha Shrivastava

163 Articles Published

Articles by Nikitasha Shrivastava

Page 10 of 17

Largest difference between element with a twist in JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 14-Aug-2023 222 Views

In this problem statement we have to find the largest difference between elements with a twist with the help of Javascript functionalities. So we will use basic Javascript to get the desired result. Understanding the problem The problem at hand is to find the largest difference between two items in an array. So we will add a twist to the problem. So we will not simply find the difference between two items but we will find the largest difference between an item and any smaller item that has appeared before in the array. And we will not rearrange ...

Read More

JavaScript Total subarrays with Sum K

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 14-Aug-2023 488 Views

In this problem statement, our task is to write the function for getting the total subarrays with sum K with the help of Javascript. So for doing this task we will use basic functionality of Javascript. Understanding the problem statement The problem statement is to create a function which will take an array of integers and a target sum K. So after processing the calculation it will return the total number of subarrays in the array with a sum of K. A subarray can be defined as a continuous series of items in the array. For example suppose ...

Read More

isSubset of two arrays in JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 14-Aug-2023 441 Views

Our goal in the above problem statement is to use Javascript functionalities and determine whether or not the given arrays are subsets of each other. So using loops we can fix this problem. Understanding the problem The problem description specifies that we have to identify that the given array is a subset of another array. Or we have to check that all of the items in the second array are present in the first array. For example, suppose we have an array like ['a', 'b', 'c', 'd', 'e'] and a second array ['b', 'd', 'e']. So when we ...

Read More

How to split sentence into blocks of fixed length without breaking words in JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 14-Aug-2023 2K+ Views

In the given problem statement we have to split the given sentence into blocks of fixed length without breaking the words of the sentence. And we have to implement the solution in Javascript. Understanding the Problem The problem at hand is to split the given sentence into blocks of a fixed length without breaking its words. So we will divide the sentence into substrings of a given length and also we will ensure that the words will remain intact in every block. For example suppose we have a sentence as "You are reading this article on ...

Read More

How to shift each letter in the given string N places down in the alphabet in JavaScript?

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 14-Aug-2023 2K+ Views

In the given problem statement our aim is to shift every letter in the given string N places down in the alphabet with the help of Javascript functionalities. So we will use some basic Javascript methods to complete the given task. Understanding the Problem The problem at hand is to shift the character of the given string up to the N places down in the alphabets with the help of Javascript. The purpose of this problem is we need to take a string as input and we have to update the given string by shifting every letter N ...

Read More

How to reverse a string using only one variable in JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 14-Aug-2023 295 Views

In this problem statement, our target is to print the reverse string using only one variable and implement the solution with the help of Javascript. So we can solve this problem with the help of loops in Javascript. Understanding the problem The given problem is stating that we have given a string to which we have to reverse the string. In simple terms we can say that if we have the string “Hello World”, the reverse of this string will be “dlroW ,olleH”. Logic for the given problem In order to reverse the given ...

Read More

How to get almost increasing sequence of integers in JavaScript ?

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 14-Aug-2023 440 Views

In the given problem statement we have to get an almost increasing sequence of integers with the help of Javascript functionalities. So we will use some basic functionalities of mathematics and Javascript. Understanding the problem The problem at hand is to generate an almost increasing series of integers in Javascript. So the almost increasing sequence is a sequence in which every item is greater than or equal to the previous item. In other terms we will say it allows for a single item in the sequence where an item is smaller than the previous item. So the resultant ...

Read More

Group a sorted array based on the difference between current and previous elements in JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 14-Aug-2023 517 Views

In the given problem statement we have to group a sorted array based on the difference between the current and previous elements with the help of Javascript functionalities. To group a sorted array based on the difference between the current and previous items we can iterate over the array and create a new array of groups. Understanding the Problem Statement The above problem statement states that we have to find out the group of elements based on the difference between the current and previous elements in the array. As we have given a sorted array so we need ...

Read More

Given an array of integers return positives, whose equivalent negatives present in it in JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 14-Aug-2023 587 Views

In the given problem statement we are presented with an array which contains positive and negative values. So our task is to keep the positive once and filter out the negative numbers from the array. And implement the solution in Javascript. Understanding the Problem We will be given an array of integer numbers and we need to find the positive integers which have their respective negative integers present in the array. For example suppose we have an array of integers like [7, -7, 8, -8, 9, -9], in this array we can see that their is some positive ...

Read More

Getting century from year in JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 14-Aug-2023 2K+ Views

In the given problem statement we are required to get the century from the given year with the help of Javascript functionalities. So we will use the basic functions of Javascript to solve this problem. Understanding the Problem The problem at hand is to find the century number of the given input year. So basically we have to create an algorithm for finding the century number corresponding to the given year. So first understand what the century number is! A century represents a period of 100 years, beginning from the year 1. For example, the 20th century ...

Read More
Showing 91–100 of 163 articles
« Prev 1 8 9 10 11 12 17 Next »
Advertisements