Arnab Chakraborty has Published 4452 Articles

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

Arnab Chakraborty

Arnab Chakraborty

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

636 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

265 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

105 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

850 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

338 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

313 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

601 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

Program to remove duplicate characters from a given string in Python

Arnab Chakraborty

Arnab Chakraborty

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

7K+ Views

Suppose we have a string s. We have to remove all duplicate characters that have already appeared before. The final string will have same ordering of characters like the actual one.We can solve this by using ordered dictionary to maintain the insertion order of the characters. The value will be ... Read More

Python program to check credit card number is valid or not

Arnab Chakraborty

Arnab Chakraborty

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

3K+ Views

Suppose we have a credit card number. We have to check whether the card number is valid or not. The card numbers have certain properties −It will start with 4, 5 and 6It will be 16 digits’ longNumbers must contain only digitsIt may have digits in four groups separated by ... Read More

Program to rotate a string of size n, n times to left in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 09:04:27

441 Views

Suppose we have a string s of size n. We have to find all rotated strings by rotating them 1 place, 2 places ... n places.So, if the input is like s = "hello", then the output will be ['elloh', 'llohe', 'lohel', 'ohell', 'hello']To solve this, we will follow these ... Read More

Advertisements