Arnab Chakraborty has Published 4293 Articles

Check whether product of integers from a to b is positive, negative or zero in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 04:43:56

198 Views

Suppose we have lower limit and upper limit of a range [l, u]. We have to check whether the product of the numbers in that range is positive or negative or zero.So, if the input is like l = -8 u = -2, then the output will be Negative, as ... Read More

Check whether product of digits at even places of a number is divisible by K in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 04:42:45

137 Views

Suppose we have a number n, and another number k, we have to check whether the product of digits at even places of n is divisible by k or not. Places are started counting from right to left. Right most is at place 1.So, if the input is like n ... Read More

Check whether product of digits at even places is divisible by sum of digits at odd place of a numbers in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 04:42:05

574 Views

Suppose we have a number n, we have to check whether the product of digits at even places of n is divisible by sum of digits at odd place of n or not. Places are started counting from right to left. Right most is at place 1.So, if the input ... Read More

Check whether N is a Dihedral Prime Number or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 04:38:01

236 Views

Suppose we have a number n. We have to check whether n is dihedral prime or not. A number is said to be dihedral prime when that number is itself prime and also shown same number or any other prime number using 7-segment display regardless the orientation of the display ... Read More

Check whether K-th bit is set or nots in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 04:36:45

3K+ Views

Suppose we have a number n and another value k. We have to check whether the kth bit in n is set (1) or not. The value of k is considered from right hand side.So, if the input is like n = 23, k = 3, then the output will ... Read More

Check whether it is possible to make both arrays equal by modifying a single element in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 04:35:12

221 Views

Suppose we have two arrays nums1 and nums2 and another value k. We have to check whether both arrays can be made equal by modifying any one element from the nums1 in the following way (only once): We can add any value from the range [-k, k] to any element ... Read More

Check whether given three numbers are adjacent primes in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 04:34:09

178 Views

Suppose we have three numbers and we have to check whether they are adjacent primes are not. The adjacent primes are prime numbers where no other prime is present between them.So, if the input is like nums = [5, 7, 11], then the output will be True.To solve this, we ... Read More

Check whether given string can be generated after concatenating given strings in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 04:33:33

151 Views

Suppose we have two strings s and t and r, we have to check whether r = s | t or r = t + s where | denotes concatenation.So, if the input is like s = "world" t = "hello" r = "helloworld", then the output will be True ... Read More

Check whether given floating point number is even or odd in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 04:29:44

1K+ Views

Suppose we have a floating point number; we have to check whether the number is odd or even. In general, for integer it is easy by dividing the last digit by 2. But for floating point number it is not straight forward like that. We cannot divide last digit by ... Read More

Check whether given degrees of vertices represent a Graph or Tree in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 04:28:56

238 Views

Suppose we have a list of degrees of some vertices. We have to check whether it is forming graph or tree.So, if the input is like deg = [2, 2, 3, 1, 1, 1], then the output will be TreeTo solve this, we will follow these steps −vert := number ... Read More

Advertisements