Arnab Chakraborty has Published 4293 Articles

Check if any two intervals overlap among a given set of intervals in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Dec-2020 13:11:59

904 Views

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

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

167 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 large number is divisible by 17 or not in Python

Arnab Chakraborty

Arnab Chakraborty

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

702 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 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

733 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

161 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 of 1s and 2s can be divided into 2 parts with equal sum in Python

Arnab Chakraborty

Arnab Chakraborty

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

180 Views

Suppose we have an array nums which only stores 1 and 2 in it. We have to check whether the array can be divided into two different parts such that sum of elements in each part is same.So, if the input is like nums = [1, 1, 2, 2, 2], ... Read More

Check if an array is stack sortable in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Dec-2020 12:45:27

315 Views

Suppose we have an array nums of unique elements from 1 through n. We have to check whether it is stack-sortable or not. An array is stack sortable when it can be stored in some other array using a temporary stack.To solve this, we can use any of these operations ... Read More

Check if an array contains all elements of a given range in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Dec-2020 12:41:31

2K+ Views

Suppose we have an array called nums. We also have two numbers x and y defining a range [x, y]. We have to check whether the array contains all elements in the given range or not.So, if the input is like nums = [5, 8, 9, 6, 3, 2, 4] ... Read More

Check if all the 1s in a binary string are equidistant or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Dec-2020 12:36:14

171 Views

Suppose we have a binary string str, we have to check whether all of the 1s in the string are equidistant or not. In other words, the distance between every two 1s is same. And the string contains at least two 1s.So, if the input is like s = "100001000010000", ... Read More

Check if all sub-numbers have distinct Digit product in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Dec-2020 12:34:56

248 Views

Suppose we have a number n, we have to check whether all sub-numbers of this number have unique digit product or not. As we know, n digit number has n*(n+1)/2 sub-numbers. For example, the sub-numbers of 135 are 1, 3, 5, 13, 35, 135. And the digit product of a ... Read More

Advertisements