AmitDiwan has Published 10744 Articles

Searching in a sorted 2-D array in JavaScript

AmitDiwan

AmitDiwan

Updated on 19-Jan-2021 06:22:16

99 Views

We are required to write a JavaScript function that takes in an array of arrays of numbers as the first argument and a number as the second argument. The subarrays contain numbers sorted in an increasing order and no element of a preceding subarray is greater than any element of ... Read More

Finding the smallest positive integer not present in an array in JavaScript

AmitDiwan

AmitDiwan

Updated on 19-Jan-2021 06:19:14

861 Views

We are required to write a JavaScript function that takes in array of integers as the first and the only argument.Our function should find and return that smallest positive integer which is not present in the array.For example −If the input array is −const arr = [4, 2, -1, 0, ... Read More

Triplet with desired sum in JavaScript

AmitDiwan

AmitDiwan

Updated on 19-Jan-2021 06:17:35

290 Views

We are required to write a JavaScript function that takes in an array of numbers as the first argument and a number as the second argument. The function should prepare and return an array of all such triplets (consecutive or nonconsecutive), that add up to the number specified by the ... Read More

Digit sum upto a number of digits of a number in JavaScript

AmitDiwan

AmitDiwan

Updated on 19-Jan-2021 06:15:34

434 Views

We are required to write a JavaScript function that takes in two numbers, let’s say m and n as arguments.n will always be smaller than or equal to the number of digits present in m. The function should calculate and return the sum of first n digits of m.For example ... Read More

Smallest prime number just greater than the specified number in JavaScript

AmitDiwan

AmitDiwan

Updated on 19-Jan-2021 06:14:10

387 Views

We are required to write a JavaScript function that takes in a positive integer as the first and the only argument.The function should find one such smallest prime number which is just greater than the number specified as argument.For example −If the input is −const num = 18;Then the output ... Read More

Arranging words by their length in a sentence in JavaScript

AmitDiwan

AmitDiwan

Updated on 19-Jan-2021 06:12:28

337 Views

We are required to write a JavaScript function that takes in a sentence as the first and the only argument.A sentence is a special kind of string of characters joined by finite number of whitespaces.The function should rearrange the words of the sentence such that the smallest word (word with ... Read More

Sorting array according to increasing frequency of elements in JavaScript

AmitDiwan

AmitDiwan

Updated on 19-Jan-2021 06:10:22

334 Views

We are required to write a JavaScript function that takes in an array of literals as the first and the only argument.The array is likely to contain many repeating values. Our function should sort the array such that the values that are unique or that have the least frequency are ... Read More

Shuffling string based on an array in JavaScript

AmitDiwan

AmitDiwan

Updated on 19-Jan-2021 06:08:33

325 Views

We are required to write a JavaScript function that takes in a string, say str as the first argument and an array of positive integers, say arr of the same length as the second argument.Our function should shuffle the characters in the string such that the character at the ith ... Read More

Finding the longest Substring with At Least n Repeating Characters in JavaScript

AmitDiwan

AmitDiwan

Updated on 19-Jan-2021 06:07:00

449 Views

We are required to write a JavaScript function that takes in a string as the first argument and a positive integer n as the second argument.The string is likely to contain some repeating characters. The function should find out and return the length of the longest substring from the original ... Read More

How can BeautifulSoup be used to extract ‘href’ links from a website?

AmitDiwan

AmitDiwan

Updated on 18-Jan-2021 12:53:53

13K+ Views

BeautifulSoup is a third party Python library that is used to parse data from web pages. It helps in web scraping, which is a process of extracting, using, and manipulating the data from different resources.Web scraping can also be used to extract data for research purposes, understand/compare market trends, perform ... Read More

Advertisements