Arnab Chakraborty has Published 4452 Articles

Check if any permutation of N equals any power of K in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Dec-2020 13:09:06

117 Views

Suppose, we have two positive integers n and m, such that 2 ≤ n ≤ 1018 and 2 ≤ m ≤ n. Our goal is to find out if there are any all-digit-permutations of the number n; so that it is equal to some power of m. If there is ... Read More

Check if any permutation of a number is divisible by 3 and is Palindromic in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Dec-2020 13:07:10

119 Views

Suppose, we are provided with a large positive integer number N. We have to check if we can find out a number from its digit-permutations; such that the permutation is equal to its reverse form, i.e. its palindrome, and is also divisible by 3.For example, suppose we have the number ... Read More

Check if any permutation of a large number is divisible by 8 in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Dec-2020 13:05:09

675 Views

Suppose, we are provided with a huge number and we have to find out whether any permutation of the digits of the number is divisible by 8. The number is provided to us in string format.So, if the input is like: input_num = 4696984, then the output will be “Divisible ... Read More

Check if any large number is divisible by 19 or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Dec-2020 13:02:30

321 Views

Suppose, we are given a large number and we have to check whether the number is divisible by 19.So, if the input is like 86982, then the output will be “Divisible”.We will solve this problem using the repeated addition method, where we extract the last digit from the number, multiply ... Read More

Check if any large number is divisible by 17 or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Dec-2020 13:01:12

528 Views

Suppose, we are given a number and we have to check whether the number is divisible by 17.So, if the input is like 99943, then the output will be Divisible.We will solve this problem using the repeated subtraction method, where we extract the last digit of the number and subtract ... Read More

Check if any interval completely overlaps the other in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Dec-2020 12:55:17

2K+ Views

Suppose, we are given a set of intervals that consists of values (a, b) where a represents the starting time and b represents the ending time of an event. Our task is to check whether any of these intervals completely overlap any other interval in this set. If any of ... Read More

Check if any anagram of a string is palindrome or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Dec-2020 12:53:38

318 Views

Suppose we have a string s. We have to check whether an anagram of that string is forming a palindrome or not.So, if the input is like s = "aarcrec", then the output will be True one anagram of this string is "racecar" which is palindrome.To solve this, we will ... Read More

Check if an integer can be expressed as a sum of two semi-primes in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Dec-2020 12:52:09

539 Views

Suppose we have a number n, we have to check whether n can be expressed as a sum of two semi-primes or not.As we know the semi-prime is a number if it can be expressed as product of two primes number. First few semi-prime numbers are (1 - 100 range): ... Read More

Check if an encoding represents a unique binary string in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Dec-2020 12:50:11

80 Views

Suppose we have an array called nums represents an encoding of a binary string of size k, we have to check whether given encoding uniquely finds a binary string or not. Here the encoding has counts of contiguous 1s which are separated by single 0s.So, if the input is like ... Read More

Check if an array represents Inorder of Binary Search tree or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Dec-2020 12:48:46

444 Views

Suppose we have an array of numbers called nums. We have to check whether the array is holding elements of a binary search tree in the sequence of its inorder traversal or not.So, if the input is like nums = [5, 8, 15, 18, 20, 26, 39], then the output ... Read More

Advertisements