Arnab Chakraborty has Published 4293 Articles

Program to count maximum number of strings we can generate from list of words and letter counts in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Dec-2020 05:02:22

293 Views

Suppose we have a list of strings where each string contains two letters "A"s and "B"s. We have two values a and b. We have to find the maximum number of strings that can be formed. We can use at most a number of "A"s and at most b number ... Read More

Program to count number of stepping numbers of n digits in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Dec-2020 05:01:00

514 Views

Suppose we have a number n we have to find the number of stepping numbers of n digit. As we know a number is called stepping number when all adjacent digits have an absolute difference of 1. So if a number is 123, this is stepping number but 124 is ... Read More

Program to find the size of the longest sublist where car speed is constant in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Dec-2020 05:00:22

151 Views

Suppose we have a list of numbers representing the position of a car at equally spaced intervals of time. We have to find the size of the longest sublist where the car was traveling at a constant speed.So, if the input is like positions = [0, 4, 8, 12, 6, ... Read More

Program to check given push pop sequences are proper or not in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Dec-2020 04:58:16

236 Views

Suppose we have a list of numbers called pushes, and another list of numbers called pops, we have to check whether this is a valid sequence of stack push and pop actions or not.So, if the input is like pushes = [1, 2, 5, 7, 9] pops = [2, 1, ... Read More

Program to find number of square submatrices with 1 in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Dec-2020 04:56:43

136 Views

Suppose we have a 2D binary matrix, we have to find the total number of square submatrices with all 1 s are there.So, if the input is like11101110111000001011then the output will be 17 as there are 12 (1 x 1) squares, 4 (2 x 2) squares and 1 (3 x ... Read More

Program to find final states of rockets after collision in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Dec-2020 04:55:07

187 Views

Suppose we have a list of numbers called nums and that is representing rocket's size and direction. Positive integer indicates right, and negative number represents left. And the absolute value of the number represents the rocket's size. Now when two rockets collide, the smaller one will be destroyed and the ... Read More

Program to find minimum space plane required for skydivers in k days in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Dec-2020 04:53:37

152 Views

Suppose we have a list of numbers called nums where each value represents a group of people looking to skydive together. And we have another value k representing how many days they can apply for skydiving. We have to find the minimum capacity of the plane we need to be ... Read More

Program to find shortest cycle length holding target in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Dec-2020 04:50:46

400 Views

Suppose we have adjacency list of a directed graph, where each list at index i is represented connected nodes from node i. We also have a target value. We have to find the length of a shortest cycle that contains the target. If there is no solution return -1.So, if ... Read More

Program to find total cost for completing all shipments in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Dec-2020 04:47:52

302 Views

Suppose we have a list of lists called ports, where ports[i] represents the list of ports that port i is connected to. We also have another list of lists called shipments where each list of the sequence [i, j] which denotes there is a shipment request from port i to ... Read More

Program to convert a string to zigzag string of line count k in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Nov-2020 08:34:06

364 Views

Suppose we have a string s and another value k, We have to find a new string by taking each character from s and starting diagonally from top left to bottom right until reaching the kth line, then go up to top right, and so on.So, if the input is ... Read More

Advertisements