AmitDiwan has Published 10744 Articles

Finding the length of longest vowel substring in a string using JavaScript

AmitDiwan

AmitDiwan

Updated on 20-Apr-2021 09:21:18

529 Views

ProblemWe are required to write a JavaScript function that takes in a string. Our function should return the length of the longest contiguous substring that contains only vowels.ExampleFollowing is the code − Live Democonst str = 'schooeal'; const findLongestVowel = (str = '') => {    let cur = 0   ... Read More

Finding alphabet from ASCII value without using library functions in JavaScript

AmitDiwan

AmitDiwan

Updated on 20-Apr-2021 09:21:01

481 Views

ProblemWe are required to write a JavaScript function that takes in a number. Our function should return the corresponding ASCII alphabet for that number (if there exists an alphabet for that ASCII value), -1 otherwise.The condition here is that we cannot use any inbuilt function that converts these values.ExampleFollowing is ... Read More

Applying a custom function to each corresponding element of two arrays using JavaScript

AmitDiwan

AmitDiwan

Updated on 20-Apr-2021 09:20:40

181 Views

ProblemWe are required to write a JavaScript function that takes in a callback function (which takes in two arguments and returns a value) as the first argument and two arrays of essentially the same length as the second and third argument.Our function should construct and return a new array whose ... Read More

Finding the count of total upside down numbers in a range using JavaScript

AmitDiwan

AmitDiwan

Updated on 20-Apr-2021 09:18:06

243 Views

Upside Down NumbersThe numbers that remain the same when they’re rotated by 180 degrees are called upside down numbers.For instance, 9116, 69.ProblemWe are required to write a JavaScript function that takes in a range array of two numbers. Our function should return the count of all the upside down numbers ... Read More

Finding the longest consecutive appearance of a character in another string using JavaScript

AmitDiwan

AmitDiwan

Updated on 20-Apr-2021 09:17:43

236 Views

ProblemWe are required to write a JavaScript function that takes in a string as the first argument and a single character as the second argument.Our function should count and return the longest consecutive appearance of the the character in the string.ExampleFollowing is the code − Live Democonst str = 'abcdaaadse'; const ... Read More

Count of pairs in an array that have consecutive numbers using JavaScript

AmitDiwan

AmitDiwan

Updated on 20-Apr-2021 09:17:20

451 Views

ProblemWe are required to write a JavaScript function that takes in an array of integers. Our function should return the count of such contagious pairs from the array that have consecutive numbers in them.ExampleFollowing is the code − Live Democonst arr = [1, 2, 5, 8, -4, -3, 7, 6, 5]; ... Read More

All ways to divide array of strings into parts in JavaScript

AmitDiwan

AmitDiwan

Updated on 20-Apr-2021 09:17:01

282 Views

ProblemWe are required to write a JavaScript function that takes in an array of literals of at least two elements.Our function should return all the ways to divide the array into two non-empty parts.For instance −For the array ["az", "toto", "picaro", "zone", "kiwi"]The possibilities are −"(az, toto picaro zone kiwi)(az ... Read More

Calculating value of a sequence based on some input using JavaScript

AmitDiwan

AmitDiwan

Updated on 20-Apr-2021 09:16:37

136 Views

ProblemWe are required to write a JavaScript function that takes in a number n as the only input. Suppose a sequence u for which, u1 = 0 and u1 = 2Our function should find the of un for which, 6unun+1- 5unun+2+un+1un+2 = 0ExampleFollowing is the code − Live Democonst num = ... Read More

Difference Between PGP and S/MIME

AmitDiwan

AmitDiwan

Updated on 20-Apr-2021 09:16:29

871 Views

In this post, we will understand the difference between PGH and S/MIME −PGPIt has been designed to process plain text.It is not expensive in comparison to S/MIME.It can be used personally as well as at offices.It is less efficient in comparison to S/MIME.It depends on the key exchange made by ... Read More

Difference Between fork() and vfork()

AmitDiwan

AmitDiwan

Updated on 20-Apr-2021 09:13:49

1K+ Views

In this post, we will understand the difference between system calls fork and vfork −The ‘fork’ system callIn this system call, the child and parent process have separate memory spaces.The child and parent process are executed simultaneously.This call uses the copy-on-write as alternative.Child process doesn’t have the ability to suspend ... Read More

Advertisements