Arnab Chakraborty has Published 4293 Articles

Check whether triangle is valid or not if sides are given in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 05:06:08

910 Views

Suppose we have three sides. We have to check whether these three sides are forming a triangle or not.So, if the input is like sides = [14, 20, 10], then the output will be True as 20 < (10+14).To solve this, we will follow these steps −sort the list sidesif ... Read More

Check whether the vowels in a string are in alphabetical order or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 05:05:30

419 Views

Suppose we have a string s. We have to check whether the vowels present in s are in alphabetical order or not.So, if the input is like s = "helloyou", then the output will be True as vowels are e, o, o, u all are in alphabetical order.To solve this, ... Read More

Check whether the two numbers differ at one-bit position only in Python

Arnab Chakraborty

Arnab Chakraborty

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

494 Views

Suppose we have two numbers x and y. We have to check whether these two numbers differ at one-bit position or not.So, if the input is like x = 25 y = 17, then the output will be True because x = 11001 in binary and y = 10001. Only ... Read More

Check whether the sum of prime elements of the array is prime or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 05:03:01

175 Views

Suppose we have an array nums. We have to check whether the sum of all prime elements in the given array is also prime or notSo, if the input is like nums = [1, 2, 4, 5, 3, 3], then the output will be True as sum of all primes ... Read More

Check whether the sum of absolute difference of adjacent digits is Prime or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 05:01:44

215 Views

Suppose we have a number n. We have to check whether the sum of the absolute difference of adjacent digit pairs is prime or not.So, if the input is like n = 574, then the output will be True as |5-7| + |7-4| = 5, this is prime.To solve this, ... Read More

Check whether the point (x, y) lies on a given line in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 05:00:59

2K+ Views

Suppose we have a straight line in the form y = mx + b, where m is slope and b is y-intercept. And have another coordinate point (x, y). We have to check whether this coordinate point lies on that straight line or not.So, if the input is like m ... Read More

Check whether the number has only first and last bits set in Python

Arnab Chakraborty

Arnab Chakraborty

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

178 Views

Suppose we have a number n. We have to check whether the number has only two set bits at first and last position or not.So, if the input is like n = 17, then the output will be True as the binary representation of n is 10001, there is only ... Read More

Check whether the number formed by concatenating two numbers is a perfect square or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 04:59:00

182 Views

Suppose we have two numbers x and y. We have to concatenate them and check whether the resultant number is perfect square or not.So, if the input is like x = 2 y = 89, then the output will be True as after concatenating the number will be 289 which ... Read More

Check whether the number can be made perfect square after adding 1 in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 04:58:32

561 Views

Suppose we have a number n. We have to check whether the number can be a perfect square number by adding 1 with it or not.So, if the input is like n = 288, then the output will be True as after adding 1, it becomes 289 which is same ... Read More

Check whether the length of given linked list is Even or Odd in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 04:57:08

207 Views

Suppose we have a linked list, we have to check whether the length of it is odd or even.So, if the input is like head = [5, 8, 7, 4, 3, 6, 4, 5, 8], then the output will be Odd.To solve this, we will follow these steps −while head ... Read More

Advertisements