Arnab Chakraborty has Published 4452 Articles

Check whether two strings are equivalent or not according to given condition in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Jan-2021 05:09:48

307 Views

Suppose we have two strings s and t of same size. We have to check whether s and t are equivalent or not. There are few conditions to check:They both are equal. Or, If we divide the s into two contiguous substrings of same size and the substrings are s1 ... Read More

Check whether two strings are anagram of each other in Python

Arnab Chakraborty

Arnab Chakraborty

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

308 Views

Suppose we have two strings s and t we have to check whether they are anagram of each other or not.So, if the input is like s = "bite" t = "biet", then the output will be True as s ad t are made of same characters.To solve this, we ... Read More

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

695 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

315 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

319 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

101 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

168 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

1K+ 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

108 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

140 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

Advertisements