Arnab Chakraborty has Published 4293 Articles

Program to find replicated list by replicating each element n times

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 09:36:55

546 Views

Suppose we have a list of n elements; we have to repeat each element in the list n number of times.So, if the input is like nums = [1, 5, 8, 3], then the output will be [1, 1, 1, 1, 5, 5, 5, 5, 8, 8, 8, 8, 3, ... Read More

Program to find super digit of a number in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 09:36:13

2K+ Views

Suppose we have a number n. We have to find the super digit of this number. The super digit of a single digit number is the digit itself but for multi-digit numbers super digit is the sum of all digits repeatedly until the sum is a single digit number.So, if ... Read More

Program to find number of values factors of two set of numbers

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 09:33:33

84 Views

Suppose we have two arrays called nums1 and nums2. We have to find the number of values that satisfy the following conditions −The elements in nums1 are the factors of the elements which are being selectedThe elements which are selected is a factor of all of the elements of nums2So, ... Read More

Program to check points are forming convex hull or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 09:30:12

786 Views

Suppose we have outer points of a polygon in clockwise order. We have to check these points are forming a convex hull or not.From this diagram it is clear that for each three consecutive points the interior angle is not more than 180°. So if all angles are not more ... Read More

C++ Program to add few large numbers

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 09:28:31

360 Views

Suppose we have an array nums of some large numbers. The large numbers are in range (-2^31 to 2^31 - 1). We have to find the sum of these numbers.So, if the input is like nums = [5000000003, 3000000005, 8000000007, 2000000009, 7000000011], then the output will be 25000000035.To solve this, ... Read More

Program to find ith element by rotating k times to right

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 09:17:26

141 Views

Suppose we have an array nums, and a value k and another value i. We have to find the element at index i after rotating elements of nums, k number of times to the right.So, if the input is like nums = [2, 7, 9, 8, 10] k = 3 ... Read More

Python program to validate postal address format

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 09:15:26

1K+ Views

Suppose we have a postal code we have to check whether it is valid or not. A valid postal code has following criteriaIt must be a number in the range from 100000 to 999999 (both inclusive).It must not contain more than one alternating repetitive digit pair.So, if the input is ... Read More

Program to find missing numbers from two list of numbers in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 09:13:00

496 Views

Suppose we have two list of numbers say nums1 and nums2. There are some elements not necessarily unique. But these two lists are actually representing different permutations of same set of numbers. However, some of them are missing. We have to find missing numbers of these two lists and print ... Read More

Python program to find ways to get n rupees with given coins

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 09:12:47

487 Views

Suppose we have given a coins of denominations (1, 2, 5 and 10). We have to find in how many ways can we can arrange n using these dominations. We have an array called count with 4 elements, where count[0] indicates number of coins of 1, count[1] indicates number of ... Read More

Python program to find word score from list of words

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 09:08:58

704 Views

Suppose we have few words in an array. These words are in lowercase letters. We have to find the total score of these set of words based on following rules −Consider vowels are [a, e, i, o, u and y]The score of an individual word is 2 when the word ... Read More

Advertisements