AmitDiwan has Published 8358 Articles
AmitDiwan
320 Views
We are required to write a JavaScript function that takes in any number of arrays of numbers. Then the function should return an object that returns a frequency map indicating how many times each element has appeared checking in all the array.For example, If the arrays are −const a = ... Read More
AmitDiwan
895 Views
Suppose we have an array of objects like this −const arr = [ { duration: 10, any: 'fields' }, { duration: 20, any: 'other fields' }, { duration: 15, ... Read More
AmitDiwan
1K+ Views
Suppose, we have an array of names like this −const arr = ["Simon", "Mike", "Jake", "Lara", "Susi", "Blake", "James"];We are required to write a JavaScript function that takes in one such array. The function should return an array of objects with two properties −letter -> the letter on which the ... Read More
AmitDiwan
991 Views
Suppose we have an array of arrays like this −const arr = [ [ ['juice', 'apple'], ['maker', 'motts'], ['price', 12] ], [ ['juice', 'orange'], ['maker', 'sunkist'], ['price', 11] ] ];We are required to write a JavaScript function that takes in ... Read More
AmitDiwan
734 Views
We are required to write a JavaScript function that takes in an array of decimal strings. The function should return an array of strings of integers obtained by flooring the original corresponding decimal values of the array.For example, If the input array is −const input = ["1.00", "-2.5", "5.33333", "8.984563"];Then ... Read More
AmitDiwan
467 Views
Suppose, we have an array of objects like this −const arr = [ {"name": "toto", "uuid": 1111}, {"name": "tata", "uuid": 2222}, {"name": "titi", "uuid": 1111} ];We are required to write a JavaScript function that splits the objects into separate array of arrays that have the similar values ... Read More
AmitDiwan
305 Views
Suppose we have an array of sorted numbers but some elements of the array are out of their sorted order.We are required to write a JavaScript function that takes in one such array and returns a subarray of all those elements that are out of order.ExampleThe code for this will ... Read More
AmitDiwan
327 Views
We are required to write a JavaScript function that takes in a string and returns the index of first character that appears twice in the string.If there is no such character then we should return -1.ExampleThe code for this will be −const str = 'Hello world, how are you'; const ... Read More
AmitDiwan
256 Views
Suppose, we have an array of numbers like this −const arr = [1, 5, 2, 1, 2, 3, 4, 5, 7, 8, 7, 1];We are required to write a JavaScript function that takes in one such array and counts the sum of all distinct elements of the array.For example:The output ... Read More
AmitDiwan
592 Views
Suppose we have a sorted array of literals like this −const arr = [2, 2, 3, 3, 3, 5, 5, 6, 7, 8, 9];We are required to write a JavaScript function that takes in one such array and returns the first number that appears only once in the array.If there ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP