
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
401 Views
ProblemWe are required to write a JavaScript function that takes in an array of numbers. Our function should take each number in the array and square it if it is even, or square root the number if it is odd and then return the sum of all the new numbers ... Read More

AmitDiwan
1K+ Views
ProblemWe are required to write a JavaScript function that takes in a number n. Our function should that smallest number which is just greater than n and is a prime number.ExampleFollowing is the code − Live Democonst num = 101; const isPrime = (num) => { let sqrtnum = Math.floor(Math.sqrt(num)); ... Read More

AmitDiwan
403 Views
When it is required solve the maximum subarray problem using the divide and conquer method, Below is the demonstration of the same −Example Live Demodef max_crossing_sum(my_array, low, mid, high): sum_elements = 0 sum_left_elements = -10000 for i in range(mid, low-1, -1): sum_elements = sum_elements + ... Read More

AmitDiwan
876 Views
When it is required to sort a list of tuples in increasing order based on last element of every tuple, a method is defined, that iterates over the tuple and performs a simple swap to achieve the same.Below is the demonstration of the same −Example Live Demodef sort_tuple(my_tup): my_len ... Read More

AmitDiwan
568 Views
When it is required to generate random numbers within a given range and append them to a list, a method is defined, that generates random numbers and ‘append’s them to an empty list.Below is the demonstration of the same −Example Live Demoimport random def random_gen(beg, end, my_num): my_result = [] ... Read More

AmitDiwan
421 Views
When it is required to find the sum of a list where the specific element is sum of first few elements, a method is defined, that takes list as parameter. It uses list comprehension to find the cumulative sum.Below is the demonstration of the same −Example Live Demodef cumulative_sum(my_list): cumulative_list ... Read More

AmitDiwan
1K+ Views
When it is required to find all numbers in a range where there are perfect square, and sum of digits in the number is less than 10, list comprehension is used.Below is the demonstration of the same −Example Live Demolower_limit = int(input(“Enter the lower range: “)) upper_limit = int(input(“Enter the upper ... Read More

AmitDiwan
125 Views
ProblemWe are required to write a JavaScript function that takes in two arrays, specifying the lengths, widths, and heights of two cuboids.Our function should calculate the volume of both cuboids and return their absolute difference.ExampleFollowing is the code − Live Democonst h1 = 10; const w1 = 12; const l1 = ... Read More

AmitDiwan
219 Views
ProblemWe are required to write a JavaScript function that takes in the length, width and height of a cuboid and return the length of its diagonal.ExampleFollowing is the code − Live Democonst height = 10; const width = 12; const length = 15; const findDiagonal = (l, w, h) => { ... Read More