Arnab Chakraborty has Published 4452 Articles

Check if Queue Elements are pairwise consecutive in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Jan-2021 05:36:12

152 Views

Suppose we have a queue full of numbers. We have to check whether the consecutive elements in the queue are pairwise consecutive or not.So, if the input is like que = [3, 4, 6, 7, 8, 9], then the output will be True.To solve this, we will follow these steps ... Read More

Check if product of first N natural numbers is divisible by their sum in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Jan-2021 05:34:12

181 Views

Suppose we have a number n. We have to check whether the product of (1*2*...*n) is divisible by (1+2+...+n) or notSo, if the input is like num = 5, then the output will be True as (1*2*3*4*5) = 120 and (1+2+3+4+5) = 15, and 120 is divisible by 15.To solve ... Read More

Check if product of digits of a number at even and odd places is equal in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Jan-2021 05:33:59

213 Views

Suppose we have a number n. We have to check whether the product of odd placed digits and the even placed digits are same or not.So, if the input is like n = 2364, then the output will be True as product of odd placed numbers are 2 * 6 ... Read More

Check if product of array containing prime numbers is a perfect square in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Jan-2021 05:29:40

112 Views

Suppose we have an array nums with all prime numbers. We have to check whether the product of all numbers present in nums is a perfect square or not.So, if the input is like nums = [3, 3, 7, 7], then the output will be True as product of all ... Read More

Check if possible to move from given coordinate to desired coordinate in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Jan-2021 05:29:20

221 Views

Suppose we have two coordinates (sx, sy), and (tx, ty), we have to check whether we can move from starting point to ending point or not. Here we can move consists of taking a point (x, y) and transforming it to either (x, x+y) or (x+y, y).So if the inputs ... Read More

Check if one of the numbers is one’s complement of the other in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Jan-2021 05:28:55

483 Views

Suppose we have two numbers x and y. We have to check whether one of these two numbers is 1's complement of the other or not. We all know the 1's complement of a binary number is flipping all bits from 0 to 1 or 1 to 0.So, if the ... Read More

Check if number is palindrome or not in Octal in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Jan-2021 05:22:02

430 Views

Suppose we have a number which is either in octal or in decimal form. If this is in octal form check whether it is palindrome or not. If the number in decimal, then convert it to octal then check whether it is palindrome or not.So, if the input is like ... Read More

Check if number can be displayed using seven segment led in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Jan-2021 05:21:46

925 Views

Suppose we have a number n, and we have another input c. We have to check whether n can be displayed using 7-segment displays or not. Now here is a constraint. We are only allowed to glow at most c number of LEDs.So, if the input is like n = ... Read More

Check if N is Strong Prime in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Jan-2021 05:21:24

564 Views

Suppose we have a number n. We have to check whether n is a strong prime or not. As we know a number said to be strong prime when it is a prime number that is greater than the average of nearest prime numbers.So, if the input is like num ... Read More

Check if n is divisible by power of 2 without using arithmetic operators in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Jan-2021 05:17:07

315 Views

Suppose we have two numbers x and n. We have to check whether x is divisible by 2^n or not without using arithmetic operators.So, if the input is like x = 32 n = 5, then the output will be True as 32 = 2^5.To solve this, we will follow ... Read More

Advertisements