Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
AmitDiwan has Published 10740 Articles
AmitDiwan
6K+ Views
We are required to write a JavaScript function that takes in a string that might contain some continuous repeating characters.The function should compress the string like this −'wwwaabbbb' -> 'w3a2b4' 'kkkkj' -> 'k4j'And if the length of the compressed string is greater than or equal to the original string we ... Read More
AmitDiwan
170 Views
We are required to write a JavaScript function that takes in an array of numbers, arr, as the first argument and a single number, num, as the second argument.The function should then find two such numbers whose sum is greatest in the array but just less than the number num. ... Read More
AmitDiwan
496 Views
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 construct and return a new array that contains all such elements from the original array whose successor and predecessor are both present in the array. If ... Read More
AmitDiwan
216 Views
Majority Element:A majority element in an array arr of length l is an element that appears more than l/2 times and hence there is at most one such element.We need to write a JavaScript function, say isMajority() that takes an array arr which is always sorted in the increasing order ... Read More
AmitDiwan
372 Views
We will be given an array of arrays, each subarray consists of exactly two elements indicating the start and end time of a meeting.The task of our function is to find the maximum number of meetings one person can take avoiding the conflict of time. The function should finally return ... Read More
AmitDiwan
378 Views
Suppose we have a string that contains only lowercase english alphabets.For the purpose of this question, we define unit shifting of a letter as replacing that very letter to its succeeding letter in alphabets (including wrapping which means next to 'z' is 'a');We are required to write a JavaScript function ... Read More
AmitDiwan
2K+ Views
Suppose we have a string str containing lowercase English letters, and an array of arrays arr, where arr[i] = [direction, amount] −direction can be 0 (for left shift) or 1 (for right shift).amount is the amount by which string s is to be shifted.A left shift by 1 means remove ... Read More
AmitDiwan
448 Views
Arithmetic Progression:An arithmetic progression (AP) or arithmetic sequence is a sequence of numbers such that the difference between the consecutive terms is constant.For instance, the sequence 5, 7, 9, 11, 13...Suppose we have an array that represents elements of arithmetic progression in order. But somehow one of the numbers from ... Read More
AmitDiwan
283 Views
Confusing Numbers:A number in an array is confusing if it becomes another number which is also present in the array after we rotate the number by 180 degrees vertically and horizontally. For instance, if we rotate 6 by 180 degrees vertically and horizontally it becomes 9 and vice-versa.We have to ... Read More
AmitDiwan
250 Views
We are required to write a JavaScript function that takes in an array of numbers as the first and the only argument. The function should first pick the smallest number from the array and then calculate the sum of all the digits of the number.If the digit sum of that ... Read More