Arnab Chakraborty has Published 4293 Articles

Check if all people can vote on two machines in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Dec-2020 12:33:20

136 Views

Suppose we have a number n denotes n people and there are two identical voting machines. We also have an array called time of size n such that time[i] represents total time spent by i-th person to vote on any machine. At one time instant, only one person can be ... Read More

Check if all occurrences of a character appear together in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Dec-2020 13:48:54

343 Views

Suppose we have a string s and another character c, we have to check whether all occurrences of c appear together in s or not. If the character c is not present in s then also return true.So, if the input is like s = "bbbbaaaaaaaccddd", c = 'a', then ... Read More

Check if all enemies are killed with bombs placed in a matrix in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Dec-2020 13:46:49

177 Views

Suppose we have a matrix mat. There are few different values as follows The cells of matrix can hold any of these 3 characters0 for empty area.1 for bomb.2 for Enemies.Now bomb can blast in only horizontal and vertical directions from one end to another. We have to check whether ... Read More

Check if all elements of the array are palindrome or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Dec-2020 13:45:18

2K+ Views

Suppose we have a list of numbers nums. We have to check whether the list is palindrome or not.So, if the input is like nums = [10, 12, 15, 12, 10], then the output will be True.To solve this, we will follow these steps −n := size of numsreset is_palindromei := 0while i

Check if all digits of a number divide it in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Dec-2020 13:43:36

683 Views

Suppose we have a number n. We have to check whether all digits of it can divide n or not.So, if the input is like n = 135, then the output will be True, because (135 / 1 = 135), (135 / 3 = 45) and (135 / 5 = ... Read More

Check if a two-character string can be made using given words in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Dec-2020 13:36:45

162 Views

Suppose we have a string s of length 2, and also have a list of words w where all words are of length 2. We have to check whether we can concatenate words from w and that concatenated string contains s as substring or not.So, if the input is like ... Read More

Check if a triangle of positive area is possible with the given angles in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Dec-2020 13:28:56

903 Views

Suppose we have three angles. We have to check whether it is possible to create a triangle of positive area with these angles or not.So, if the input is like a = 40 b = 120 c = 20, then the output will be True as the sum of 40 ... Read More

Check if a string is the typed name of the given name in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Dec-2020 13:27:45

527 Views

Suppose we have two lowercase strings s and t. Sometimes, when we type a vowel, the key might get long pressed, and the vowel will be repeated 1 or more times. We have to check whether it is possible that t is typed that indicates s or not.So, if the ... Read More

Check if a string is suffix of another in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Dec-2020 13:26:12

440 Views

Suppose we have two strings s and t. We have to check whether s is suffix of t or not.So, if the input is like s = "ate" t = "unfortunate", then the output will be True.To solve this, we will follow these steps −s_len := size of st_len := ... Read More

Check if a string is palindrome in C using pointers

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Dec-2020 13:24:43

9K+ Views

Suppose we have a string s. We have to check whether the given string is a palindrome or not. We have to solve this problem using pointers in C.So, if the input is like s = "racecar", then the output will be True.To solve this, we will follow these steps ... Read More

Advertisements