Arnab Chakraborty has Published 4293 Articles

Check if it is possible to create a polygon with a given angle in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Jan-2021 13:05:11

251 Views

Suppose we have an angle a. We have to check whether we can make a regular polygon where all angles are same as a or not.So, if the input is like a = 120, then the output will be True the pentagon has all angles same as 120°. As we ... Read More

Check if it is possible to create a palindrome string from given N in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Jan-2021 13:04:06

504 Views

Suppose we have a number n. We have to check whether we can create an alphabetical lowercase string from that number and check whether the string is palindrome or not. Here we will take only characters from a to j, [a = 0, b = 1... j = 9]. So ... Read More

Check if it is possible to convert one string into another with given constraints in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Jan-2021 13:00:36

207 Views

Suppose we have two strings s and t with only three characters 'A', 'B' and '#'. We have to check whether it is possible to convert s into t by performing these operations on s.'A' can move only to the left hand side'B' can move only to the right hand ... Read More

Check if is possible to get given sum from a given set of elements in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Jan-2021 12:58:12

465 Views

Suppose we have an array called nums and another value sum. We have to check whether it is possible to get sum by adding elements present in nums, we may pick a single element multiple times.So, if the input is like nums = [2, 3, 5] sum = 28, then ... Read More

Check if given string can be split into four distinct strings in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Jan-2021 12:56:25

353 Views

Suppose we have a string s, we have to check whether we can split it into four sub-strings such that each of them are non-empty and unique.So, if the input is like s = "helloworld", then the output will be True as one of the possible set of sub-strings are ... Read More

Check if given number is perfect square in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Jan-2021 12:51:46

8K+ Views

Suppose we have a number n. We have to check whether the number n is perfect square or not. A number is said to be a perfect square number when its square root is an integer.So, if the input is like n = 36, then the output will be True ... Read More

Check if given number is Emirp Number or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Jan-2021 12:50:28

1K+ Views

Suppose we have a number n. We have to check whether n is an Emirp number or not. We all know Emirp number is (letters of prime in backward direction) is a prime number that results in a different prime when its digits are reversed.So, if the input is like ... Read More

Check if given number is a power of d where d is a power of 2 in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Jan-2021 12:48:48

178 Views

Suppose we a number n and another value x, we have to check whether it is a power of x or not, where x is a number power of 2.So, if the input is like n = 32768 x = 32, then the output will be True as n is ... Read More

Check if given four integers (or sides) make rectangle in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Jan-2021 12:45:40

1K+ Views

Suppose we have a list of four sides, we have to check whether these four sides are forming a rectangle or not.So, if the input is like sides = [10, 30, 30, 10], then the output will be True as there are pair of sides 10 and 30.To solve this, ... Read More

Check if given array is almost sorted (elements are at-most one position away) in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Jan-2021 12:42:56

409 Views

Suppose we have an array of numbers called nums, where all elements are unique. We have to check whether nums is almost sorted or not. As we know an array is almost sorted when any of its elements can occur at a maximum of 1 distance away from its original ... Read More

Advertisements