Largest Substring Between Two Equal Characters in a string in JavaScript

AmitDiwan
Published on 23-Jan-2021 11:24:31
We are required to write a JavaScript function that takes in a string of characters as the only argument.The function should find that longest string which is sandwiched between two identical characters and return its length.For example −If the input string is −const str = 'sadtrsewak';Then the output should be ... Read More

Checking for uniqueness of a string in JavaScript

AmitDiwan
Published on 23-Jan-2021 11:20:44
We are required to write a JavaScript function that takes in a string as the first and the only argument. The function should return true if all the characters present in the string are unique. And if even one character appears for more than one, the function should return false.We ... Read More

Maximum Product of Two Numbers in a List of Integers in JavaScript

AmitDiwan
Published on 23-Jan-2021 11:17:53
We are required to write a JavaScript function that takes in an array of integers as the first and the only argument.The function should find the maximum product that can be achieved multiplying any two elements of the array. The condition for us is that we have to do this ... Read More

Check if a string is repeating in itself in JavaScript

AmitDiwan
Published on 23-Jan-2021 11:13:58
We are required to write a JavaScript function that takes in a string as the first and the only argument.The function should detect if the string is a repetition of a same set of characters or not.If it is a repetition of the same set of characters then we should ... Read More

Counting the number of palindromes that can be constructed from a string in JavaScript

AmitDiwan
Published on 23-Jan-2021 11:12:07
We are required to write a JavaScript function that takes in a string of characters as the first argument, say str, and a number, say num, as the second argument.The function should count the number of palindrome strings all exactly of length num can be constructed from the given string ... Read More

In-place Algorithm to Move Zeros to End of List in JavaScript

AmitDiwan
Published on 23-Jan-2021 11:09:38
Suppose we are given an array of integers, lets say arr. We are required to write a function that puts all the zeros to the back of the array by modifying the list in-place.The function should do this in such a way that the relative ordering of other elements should ... Read More

Returning acronym based on a string in JavaScript

AmitDiwan
Published on 23-Jan-2021 11:07:39
We are required to write a JavaScript function that takes in a string of characters as the only argument.The function should build and return the acronym based on the string phrase provided as input.While constructing the acronym the function should take only those words into consideration that starts with an ... Read More

Counting largest numbers in row and column in 2-D array in JavaScript

AmitDiwan
Published on 23-Jan-2021 11:05:57
We are required to write a JavaScript function that takes in a two-dimensional array of integers as the only argument.The task of our function is to calculate the count of all such integers from the array that are the greatest both within their row and the column.The function should then ... Read More

Sorting only columns of a 2-D array in JavaScript

AmitDiwan
Published on 23-Jan-2021 11:03:54
We are required to write a JavaScript function that takes in a two-dimensional array of integers as the only argument.The function should sort the elements present at the column of the array in increasing or decreasing order.For example −If the input array is −const arr = [    [6, 2, ... Read More

Substring in infinitely extended string in JavaScript

AmitDiwan
Published on 23-Jan-2021 11:01:40
We are required to write a JavaScript function that takes in a string of characters as the first argument and a start index and end index as second and third argument respectively. The function should find, had that string, provided as the first argument, been extended forever by appending the ... Read More
1 2 3 4 5 6 7 ... 4435 Next
Advertisements