AmitDiwan has Published 10744 Articles

Summing numbers present in a string separated by spaces using JavaScript

AmitDiwan

AmitDiwan

Updated on 20-Apr-2021 09:11:08

633 Views

ProblemWe are required to write a JavaScript function that takes in a string which has integers inside it separated by spaces.The task of our function is to convert each integer in the string into an integer and return their sum.ExampleFollowing is the code − Live Democonst str = '1 5 12 ... Read More

Alternating sum of elements of a two-dimensional array using JavaScript

AmitDiwan

AmitDiwan

Updated on 20-Apr-2021 09:10:47

335 Views

ProblemWe are required to write a JavaScript function that takes in a 2-Dimensional array of m X n order of numbers containing the same number of rows and columns.For this array, our function should count and return the following sum−$\sum_{i=1}^m \sum_{j=1}^n (-1)^{i+j}a_{ij}$ExampleFollowing is the code − Live Democonst arr = [ ... Read More

Difference Between Symmetric and Asymmetric Multiprocessing

AmitDiwan

AmitDiwan

Updated on 20-Apr-2021 09:10:46

559 Views

In this post, we will understand the difference between symmetric and asymmetric multiprocessing −Asymmetric MultiprocessingIn this kind of multiprocessing, the processors are not considered as equal.The task of the operating system is done by the master processor.There is no communication between the processors since they are controlled by the master ... Read More

Returning the first number that equals its index in an array using JavaScript

AmitDiwan

AmitDiwan

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

122 Views

ProblemWe are required to write a JavaScript function that takes in an array of number. Our function should return that first number from the array whose value and 0-based index are the same given that there exists at least one such number in the array.ExampleFollowing is the code − Live Democonst ... Read More

Encrypting a string based on an algorithm using JavaScript

AmitDiwan

AmitDiwan

Updated on 20-Apr-2021 09:08:03

697 Views

ProblemWe are required to write a JavaScript function that takes in a string and encrypts it based on the following algorithm −The string contains only space separated words.We need to encrypt each word in the string using the following rules−The first letter needs to be converted to its ASCII code.The ... Read More

Difference Between Microkernel and Monolithic Kernel

AmitDiwan

AmitDiwan

Updated on 20-Apr-2021 09:02:48

2K+ Views

In this post, we will understand the difference between microkernel and monolithic kernel −MicrokernelIt is smaller in size.In this kernel, the services are kept in a separate address space.It executes slowly in comparison to monolithic kernel.It can be extended easily.If a service crashes, it effects the working of the microkernel.The ... Read More

Encrypting a string based on an algorithm in JavaScript

AmitDiwan

AmitDiwan

Updated on 20-Apr-2021 08:25:34

259 Views

ProblemWe are required to write a JavaScript function that takes in a string and encrypts it based on the following algorithm −The string contains only space separated words.We need to encrypt each word in the string using the following rules −The first letter needs to be converted to its ASCII ... Read More

Finding the first non-consecutive number in an array in JavaScript

AmitDiwan

AmitDiwan

Updated on 20-Apr-2021 08:23:41

389 Views

ProblemWe are required to write a JavaScript function that takes in an array of numbers. Our function should return that first element from the array which is not the natural successor of its previous element.It means we should return that element which is not +1 its previous element given that ... Read More

Checking if decimals share at least two common 1 bits in JavaScript

AmitDiwan

AmitDiwan

Updated on 20-Apr-2021 08:21:38

120 Views

ProblemWe are required to write a JavaScript function that takes in two numbers. Our function should return true if the numbers have 1 in the binary representation at the same index twice, false otherwise.ExampleFollowing is the code − Live Democonst num1 = 10; const num2 = 15; const checkBits = (num1 ... Read More

Limiting string up to a specified length in JavaScript

AmitDiwan

AmitDiwan

Updated on 20-Apr-2021 08:18:30

1K+ Views

ProblemWe are required to write a JavaScript function that takes in a string and a number. Our function should return the truncated version of the given string up to the given limit followed by "..." if the result is shorter than the original string otherwise our function should return the ... Read More

Advertisements