Nikitasha Shrivastava

Nikitasha Shrivastava

163 Articles Published

Articles by Nikitasha Shrivastava

Page 16 of 17

Function to reverse a string JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 18-May-2023 610 Views

In this problem statement, our target is to print the n consecutive odd numbers and implement this problem with the help of Javascript functionalities. So we can solve this problem with the help of loops in Javascript. Understanding the problem statement 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”, the reverse of this string will be “olleH”. Logic for the given problem For solving the above problem we need to have the basic knowledge of ...

Read More

Function to find out palindrome strings JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 18-May-2023 235 Views

In this problem statement, our aim is to create a function to find out that the given string is palindrome with the help of Javascript functionalities. So for solving this problem first we need to understand the problem in simple terms. Understanding the problem statement We have given a string as an input string and our main aim is to check if the string is a palindrome string or not. If it is palindrome then return true otherwise return false. What do you mean by palindrome? In the given problem statement there is the usage of the word palindrome !! ...

Read More

Finding longest substring between two same characters JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 18-May-2023 562 Views

In this problem statement, our task is to find the longest substring between two same characters with the help of Javascript functionalities. This task can be done with the help of map function to keep track of the two same characters. Logic for the given problem The problem stated that we have to find the longest substring between two same characters in the given string. For example if we have a string like 'abcdefa', there are two same characters 'a' that have 5 characters called 'bcdef', so this will be called longest substring. For implementing the above given problem, ...

Read More

Find number of spaces in a string using JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 18-May-2023 3K+ Views

In this problem statement, our task is to find the number of spaces in a string with the help of Javascript functionalities. This task can be done with the help of the split method of Javascript. This method can be useful to split the string into an array of substrings as per the spaces. Logic for the given problem The problem stated that we have to find the number of spaces in a given string and we will use the split method. So at the very first step we will split the string and create an array of substrings as ...

Read More

Fetch Numbers with Even Number of Digits JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 18-May-2023 487 Views

In the given problem statement our task is to write the function for fetching the numbers with an even number of digits with the help of Javascript. For solving this task we will use a for loop and push every even number in the array. Understanding the problem statement The problem statement is to write a function which will take an array of numbers as input and return the array for containing only numbers that have an even number of digits. For example if we have an input array is [1 ,2 , 3, 4, 5] the function should return ...

Read More

Dynamic Programming - Part sum of elements JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 18-May-2023 518 Views

In this problem statement, our task is to calculate the sum of all the elements of the array and remove one element at every step and show the resultant array of sum of all the possible subarrays. And implement this problem with the help of Javascript functionalities. Logic for the given problem The given problem states that we have to calculate the sum of every element except one element at every step. To solve the given problem we will define an array as input and return the output as an array of sums of elements by deducting one element ...

Read More

Destructively Sum all the digits of a number in JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 18-May-2023 696 Views

Our main task is to write the function to destructively sum all the digits of a number with the help of Javascript. So for doing this task we will use a while loop and a function to get the desired output. Understanding the problem statement The problem is to create a function to calculate the sum of all the digits in the given number. Means we have given a number and we have to calculate the sum of all the digits in a destructive manner as the original number is modified during the process. For example let's say we have ...

Read More

Checking if a number is some power of the other JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 18-May-2023 440 Views

In this problem statement, our objective is to check if a given input number is some power of the other number. And implement this problem with the help of Javascript functionalities. Logic for the given problem The main objective of this problem statement is to determine if a given number is a power of another number. We need to use Javascript to implement this code. To check if a number a is a power of another number b, we can take the logarithm of a with base b using the math.log function and then we can check if the ...

Read More

Checking for string anagrams JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 18-May-2023 393 Views

In this problem statement, our aim is to check for string anagrams with the help of Javascript functionalities. So for solving this problem first we need to understand the problem in simple terms. Understanding the problem statement We have given a string as an input string and our main aim is to check if the string is an anagram string or not. If it is anagram then return true otherwise return false. What do you mean by anagrams? In the given problem statement there is the usage of the word anagram!! Let’s first understand the meaning of this word. Anagram ...

Read More

Calculating median of an array in JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 18-May-2023 4K+ Views

In this problem statement, our task is to calculate the median of an array with the help of Javascript functionalities. There are several ways that can be used to solve this task. One simple method to calculate median is using the built-in function of Javascript. Understanding the problem statement The problem statement is to write a function in Javascript that will help to calculate the median of a given array. For example, if we have an array of integers [1, 2, 3, 4, 5] so the median of this array is 3. Because 3 is the middle element of the ...

Read More
Showing 151–160 of 163 articles
Advertisements