Arnab Chakraborty has Published 4452 Articles

Check if linked list is sorted (Iterative and Recursive) in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Jan-2021 04:49:59

399 Views

Suppose we have a linked list we have to define two functions to check whether the linked list is sorted in non-increasing order or not. One of the method will work as iterative manner and another one in recursive manner.So, if the input is like L = [15, 13, 8, ... Read More

Check if leaf traversal of two Binary Trees is same in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Jan-2021 04:43:59

96 Views

Suppose we have two binary tree. We have to check whether leaf traversal of these two trees are same or not. As we know the leaf traversal is sequence of leaves traversed from left to right.So, if the input is likethen the output will be True as the left traversal ... Read More

Check if LCM of array elements is divisible by a prime number or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Jan-2021 04:40:50

79 Views

Suppose we have an array called nums and another value k, we have to check whether LCM of nums is divisible by k or not.So, if the input is like nums = [12, 15, 10, 75] k = 10, then the output will be True as the LCM of the ... Read More

Check if item can be measured using a scale and some weights in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Jan-2021 04:40:32

207 Views

Suppose we have some weights like a^0, a^1, a^2, …, a^100, here 'a' is an integer, and we also have a weighing scale where weights can be put on both the sides of that scale. We have to check whether a particular item of weight W can be measured using ... Read More

Check if it possible to partition in k subarrays with equal sum in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Jan-2021 04:38:05

134 Views

Suppose we have an array of numbers called nums, and also have another value K. We have to check whether we can partition the array nums into K contiguous subarrays such that the elements sum of each subarrays is equal.So, if the input is like nums = [2, 5, 3, ... Read More

Check if it is possible to transform one string to another in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Jan-2021 04:37:38

325 Views

Suppose we have two strings s and t, t is in uppercase. We have to check whether we can convert s to t by performing following operations.Convert some lowercase letters uppercase.Remove all of the lowercase letters.So, if the input is like s = "fanToM", t = "TOM", then the output ... Read More

Check if it is possible to survive on Island in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Jan-2021 04:37:19

338 Views

Suppose there is an island. There is only one store in that location, this store remains open always except Sunday. We have following values as input −N (Maximum number of food someone can buy each day).S (Number of days someone is required to survive).M (Number of food required each day ... Read More

Check if it is possible to sort the array after rotating it in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Jan-2021 04:29:36

151 Views

Suppose we have a list of numbers called nums, we have to check whether we can sort nums or not by using rotation. By rotation we can shift some contiguous elements from the end of nums and place it in the front of the array.So, if the input is like ... Read More

Check if it is possible to sort an array with conditional swapping of adjacent allowed in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Jan-2021 04:28:47

213 Views

Suppose we have an unordered array of numbers called nums and all elements are in range 0 to n-1. We can swap adjacent elements in nums as many times as required but only when the absolute difference between these element is 1. We have to check whether we can sort ... Read More

Check if it is possible to serve customer queue with different notes in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Jan-2021 04:25:42

50 Views

Suppose we have an array called notes represents different rupee notes holding by customers in a queue. They are all waiting to buy tickets worth Rs 50. Here possible notes are [50, 100 and 200]. We have to check whether we can sell tickets to the people in order or ... Read More

Advertisements