Arnab Chakraborty has Published 4293 Articles

Program to find how many ways we can climb stairs (maximum steps at most k times) in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 12:28:55

252 Views

Suppose we have a staircase with n steps and we also have another number k, initially we are at stair 0, and we can climb up either 1, 2 or 3 steps at a time. but we can only climb 3 stairs at most k times. Now we have to ... Read More

Program to check we can reach end of list by starting from k in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 12:27:54

375 Views

Suppose we have a list of numbers called nums and another number k. If we start at index k and at any index i, we can go either left or right by exactly nums[i] number of steps. We have to check whether we can reach the end of the list ... Read More

Program to find how many ways we can climb stairs in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 12:25:32

339 Views

Suppose we have a staircase with n steps, and we can climb up either 1 or 2 steps at a time. We have to define a function that returns the number of unique ways we can climb the staircase.The order of the steps should not be changed, so each different ... Read More

Program to check we can spell out the target by a list of words or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 12:23:00

190 Views

Suppose we have a list of numbers called nums and another number k. If we start at index k and at any index i, we can go either left or right by exactly nums[i] number of steps. We have to check whether we can reach the end of the list ... Read More

Program to add two binary strings, and return also as binary string in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 12:19:16

1K+ Views

Suppose we have two binary strings a and b, we have to add these binary numbers and find their sum, also as a string.So, if the input is like a = "10110", b = "10010", then the output will be "101000".To solve this, we will follow these steps −ret := ... Read More

Program to find maximum amount we can get by taking different items within the capacity in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 12:15:03

582 Views

Suppose we have two lists called weights and values which are of same length and another number called capacity k. Here weights[i] and values[i] shows the weight and value of the ith item. Now, we can take at most k capacity weights, and that we can only take at most ... Read More

Program to find the sum of elements that forms a Z shape on matrix in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 12:12:57

455 Views

Suppose we have one n x n matrix M, we have to find the sum of all elements that form a Z shape in the matrix.So, if the input is like432918256then the output will be 23, as elements are [4+3+2+1+2+5+6] = 23.To solve this, we will follow these steps −n ... Read More

Program to find the maximum profit we can get by buying on stock market multiple times in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 12:08:38

300 Views

Suppose we have a list of prices representing the stock prices of a company in chronological sequence, we have to find the maximum profit we could have made from buying and selling that stock any number of times. We have to keep in mind that we must buy before we ... Read More

Program to find the maximum profit we can get by buying on stock market once in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 12:07:00

1K+ Views

Suppose we have a list of prices representing the stock prices of a company in chronological sequence, we have to find the maximum profit we could have made from buying and selling that stock only once. We have to keep in mind that we must buy before we can sell ... Read More

Program to check whether given graph is bipartite or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2020 12:05:32

816 Views

Suppose we have one undirected graph, we have to check whether the graph is bipartite or not. As we know a graph is bipartite when we can split the nodes of the graph into two sets A and B such that every edge {u, v} in the graph has one ... Read More

Advertisements