
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 10744 Articles

AmitDiwan
384 Views
Usually when we convert a decimal to hexadecimal (base 16) we use the set 0123456789ABCDEF to map the number.We are required to write a function that does exactly the same but provides user the freedom to use any scale rather than the one mentioned above.For example −The hexadecimal notation of ... Read More

AmitDiwan
498 Views
Consider, we have the following array of objects −const arr = [{ id: 121, hobby: 'cycling' }, { id: 125, hobby: 'jogging' }, { id: 129, hobby: 'reading' }, { id: 121, hobby: 'writing' }, { id: 121, hobby: 'playing ... Read More

AmitDiwan
774 Views
Happy NumberA happy number is a number which eventually reaches 1 when replaced by the sum of the square of each digit. Whereas if during this process any number gets repeated, the cycle will run infinitely and such numbers are called unhappy numbers.For example − 13 is a happy number ... Read More

AmitDiwan
391 Views
Consider the following array of numbers −const arr = [10, 5, 6, 12, 7, 1];The sum of its consecutive elements taking one less element in every go will be −[10, 5, 6, 12, 7, 1] = 10 + 5 + 6 + 12 + 7 + 1 = 41; [5, ... Read More

AmitDiwan
364 Views
Let’s say, we are required to write an array method that overwrites the default Array.prototype.slice(). Usually the Array.prototype.slice() method takes in two arguments the start index and the end index, and returns a subarray of the original array from index start to end-1.What we wish to do is make this ... Read More

AmitDiwan
362 Views
Let’s say, we are required to write a function that takes in an array of string / number literals and returns the index of the item that appears for the most number of times. We will iterate over the array and prepare a frequencyMap and from that map we will ... Read More

AmitDiwan
357 Views
We have to write a function that returns true if a portion of string1 can be rearranged to string2. Write function, say scramble(str1, str2) that returns true if a portion of str1 characters can be rearranged to match str2, otherwise returns false.For example −Let’s say string1 is str1 and string2 ... Read More

AmitDiwan
175 Views
Let’s say, we have an array that contains some data about the speed of a motor boat during upstreams and downstreams like this −Following is our sample array −const arr = [{ direction: 'upstream', velocity: 45 }, { direction: 'downstream', velocity: 15 }, { direction: ... Read More

AmitDiwan
180 Views
Let’s say, we are given a string and an array. Our job is to split the string according to the corresponding elements of the array. For example −Inputconst string = 'Javascript splitting string by given array element'; const arr = [2, 4, 5, 1, 3, 1, 2, 3, 7, 2];Output['Ja', ... Read More

AmitDiwan
147 Views
We are required to write a function that returns a random hex color. So here is the code for doing so −Exampleconst generateRandomColor = () => { const keys = '0123456789ABCDEF'; let color = ''; while(color.length < 6){ const random = Math.floor(Math.random() * 16); ... Read More