Arnab Chakraborty has Published 4293 Articles

Program to check one string can be converted to other by shifting characters clockwise in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 07:14:14

424 Views

Suppose we have two strings p and q, and also have a number r, we have to check whether p can be converted to q by shifting some characters clockwise at most r times. So, as an example, "c" can be turned into "e" using 2 clockwise shifts.So, if the ... Read More

Program to check whether one value is present in BST or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 07:03:54

1K+ Views

Suppose we have a binary search tree and another input called val, we have to check whether val is present in the tree or not.So, if the input is likeval = 7, then the output will be True, as 7 is present in the tree.To solve this, we will follow ... Read More

Program to add two numbers represented as strings in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 06:56:03

3K+ Views

Suppose we have two strings S, and T, these two are representing an integer, we have to add them and find the result in the same string representation.So, if the input is like "256478921657", "5871257468", then the output will be "262350179125", as 256478921657 + 5871257468 = 262350179125To solve this, we ... Read More

Program to check whether list is strictly increasing or strictly decreasing in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 06:53:08

2K+ Views

Suppose we have a list of numbers; we have to check whether the list is strictly increasing or strictly decreasing.So, if the input is like nums = [10, 12, 23, 34, 55], then the output will be True, as all elements are distinct and each element is larger than the ... Read More

Program to sqeeze list elements from left or right to make it single element in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 06:48:02

183 Views

Suppose we have a list of numbers called nums, we have to squeeze it from both the left and the right until there is one remaining element. We will return the states at each step.So, if the input is like nums = [10, 20, 30, 40, 50, 60], then the ... Read More

Program to sorting important mails from different mailboxes in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 06:42:54

411 Views

Suppose we have a list of mailboxes. Here in each mailbox a list of strings is given, here each string is either "J" for junk, "P" for personal, "W" for Work. We will go through each mailbox in round robin order starting from the first mailbox, filtering out J, to ... Read More

Program to count number of elements are placed at correct position in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 06:39:45

367 Views

Suppose we have a list of numbers called nums, we have to find the number of elements that are present in the correct indices, when the list was to be sorted.So, if the input is like [2, 8, 4, 5, 11], then the output will be 2, as the elements ... Read More

Program to check whether we can stand at least k distance away from the closest contacts in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 06:38:07

77 Views

Suppose we have a string s and a number k. Now each character in the string is either dot ('.') or 'x', where dot indicates an empty space and 'x' indicates a person. We have to check whether it's possible to choose a position to stand on such that the ... Read More

Program to find shortest sublist so after sorting that entire list will be sorted in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 06:35:44

236 Views

Suppose we have a list of numbers called nums, we have to find the length of the shortest sublist in num, if the sublist is sorted, then the entire array nums will be sorted in ascending order.So, if the input is like nums = [1, 2, 5, 4, 9, 10], ... Read More

Program to find shortest string after removing different adjacent bits in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 06:33:53

287 Views

Suppose we have a binary string s, we can delete any two adjacent letters if they are different. Finally, we have to find the length of the smallest string that we can get if we are able to perform this operation as many times as we want.So, if the input ... Read More

Advertisements