Arnab Chakraborty has Published 4293 Articles

Program to find the maximum width of a binary tree in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 11:54:32

189 Views

Suppose we have a binary tree, we have to find the maximum width of any level in the tree. Here the width of a level is the number of nodes that can hold between the leftmost node and the rightmost node.So, if the input is like then the output will be ... Read More

Program to find the number of possible position in a line in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 08:03:13

269 Views

Suppose we have a number n, and p and q. Now suppose we are standing in a line of n people. We do not know which position we are in, but we know there are at least p people in front of us and at most q people behind us. ... Read More

Program to sort all vowels at beginning then the consonants, are in sorted order in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 08:00:46

2K+ Views

Suppose we have a lowercase alphabet string s, we have to find a string with all the vowels of s in sorted sequence followed by all consonants of s in sorted sequence.So, if the input is like "helloworld", then the output will be "eoodhlllrw", as vowels are "eo" And consonants ... Read More

Program to encrypt a string using Vigenere cipher in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 07:59:32

4K+ Views

Suppose we have a lowercase alphabet string text, and have another string called key. We have to find a new string where every letter in text[i] is moved to the right side with offset key[i]. Here the offset represented by key[i]'s position in the alphabet (A=0, B=1 etc.) If the ... Read More

Program to encrypt a string using Vertical Cipher in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 07:57:34

304 Views

Suppose we have a string s and a number n, we have to rearrange s into n rows so that s can be selected vertically (top to down, left to right).So, if the input is like s = "ilovepythonprogramming" n = 5, then the output will be ['ipnrn', 'lypag', 'otrm', ... Read More

Program to find the resolved Unix style path in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 07:55:08

189 Views

Suppose we have a Unix path, in a list of strings, we have to find its resolved version. As we know in Unix, ".." denotes the previous directory and "." denotes stay on the current directory. Here resolving indicates evaluation of the two symbols so that we get the final ... Read More

Program to find the number of unique integers in a sorted list in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 07:52:19

277 Views

Suppose we have a list of sorted numbers called nums we have to find the number of unique elements in the list.So, if the input is like nums = [3, 3, 3, 4, 5, 7, 7], then the output will be 4, as The unique numbers are [3, 4, 5, ... Read More

Program to find number of string we can make where 'a' can be 'a' or 'b', and 'b' remains 'b'in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 07:50:29

263 Views

Suppose we have a string s with only "a" and "b". "a"s can stay "a" or turn into "b", but "b"s can not be changed. We have to find the number of unique strings that we can make.So, if the input is like s = "baab", then the output will ... Read More

Program to check a number is ugly number or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 07:48:51

889 Views

Suppose we have a number n, we have to check whether its prime factors only include 2, 3 or 5 or not.So, if the input is like n = 18, then the output will be True, as 18's prime factors are 2 and 3.To solve this, we will follow these ... Read More

Program to create one triangle stair by using stars in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 07:45:58

673 Views

Suppose we have a number n, we have to find a string of stairs with n steps. Here each line in the string is separated by a newline separator.So, if the input is like n = 5, then the output will be         *       ... Read More

Advertisements