Arnab Chakraborty has Published 4293 Articles

Group Integers in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Sep-2020 06:59:26

918 Views

Suppose we have a list of numbers called nums, we have to check whether we can split the list into 1 or more groups such that: 1. Size of each group is greater than or equal to 2. 2. Sizes of all groups are same. 3. All the numbers present ... Read More

Greatest common divisors in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Sep-2020 06:54:22

273 Views

Suppose we have a list of positive numbers called nums, we have to find the largest positive number that divides each of the number.So, if the input is like [14, 28, 70, 56], then the output will be 14.To solve this, we will follow these steps −ans := first element ... Read More

Generate a list of Primes less than n in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Sep-2020 06:53:11

5K+ Views

Suppose we have a number n, we have to generate a list of all prime numbers smaller than or equal to n in ascending order. We have to keep in mind that 1 is not a prime number.So, if the input is like 12, then the output will be [2, ... Read More

Number of Programmer Worked on given Time in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Sep-2020 06:51:56

87 Views

Suppose we have list of intervals and another input time. In each interval the structure is [start, end], this is representing the times when a programmer worked. We have to find the number of programmers that were working at time.So, if the input is like interval = [[2, 6], [4, ... Read More

Justify Frame Width in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Sep-2020 06:48:00

93 Views

Suppose we have a list of words, we have to frame it in a rectangular region, line by line. See the example for better understanding.So, if the input is like ['hello', 'world', 'python', 'programming', 'nice'], then the output will be*************** * hello       * * world     ... Read More

Flip and Invert Matrix in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Sep-2020 06:45:51

782 Views

Suppose we have a binary matrix mat. We have to select each row in matrix, then reverse the row. After that, flip each bit (0 to 1 and 1 to 0).So, if the input is like110010001then the output will be100101011To solve this, we will follow these steps −track:= 0for each ... Read More

Replace Multiple of 3 and 5 With Fizz, Buzz in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Sep-2020 06:36:31

5K+ Views

Suppose we have a number n. We have to find a string that is representing all numbers from 1 to n, but we have to follow some rules.When the number is divisible by 3, put Fizz instead of the numberWhen the number is divisible by 5, put Buzz instead of ... Read More

Python finding programming question in a String

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Sep-2020 11:37:46

182 Views

Suppose we have a lowercase string s, we have to check whether it's possible to pick some subsequence of characters in s such that − 1. The difference of any two successive indexes of the characters is same 2. The characters form the string "programmingquestion"So, if the input is like ... Read More

Swap Consecutive Even Elements in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Sep-2020 11:33:11

603 Views

Suppose we have a list of numbers called nums, we have to exchange every consecutive even integer with each other.So, if the input is like nums = [4, 5, 6, 8, 10], then the output will be [6, 5, 4, 10, 8]To solve this, we will follow these steps −temp ... Read More

Remove Substrings in One Iteration in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Sep-2020 11:31:32

168 Views

Suppose we have a string s, we have to remove all “y” and “xz” in the string in one iteration.So, if the input is like s = "xyxxzyyxxzx", then the output will be xxxxTo solve this, we will follow these steps −To solve this, we will follow these steps −temp ... Read More

Advertisements