Arnab Chakraborty has Published 4293 Articles

Program to find number of magic sets from a permutation of first n natural numbers in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Oct-2021 07:27:51

124 Views

Suppose we have an array A with first n natural numbers, and one permutation P{p1, p2, ... pn} of array A. We have to check how many magic sets are there. A permutation is said to be magic set, if this satisfies these few rules −If we have k, then ... Read More

Program to find number of sequences after adjacent k swaps and at most k swaps in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Oct-2021 07:23:12

350 Views

Suppose we have an array A with first n natural numbers. We have to find how many sequences (S1) can we get after exact k adjacent swaps on A? And how many sequences (S2) can we get after at most k swaps on A? Here the adjacent swap means swapping ... Read More

Program to find number of strictly increasing colorful candle sequences are there in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Oct-2021 07:19:41

239 Views

Suppose there are n candles which are aligned from left to right. The i-th candle from the left side has the height h[i] and the color c[i]. We also have an integer k, represents there are colors in range 1 to k. We have to find how many strictly increasing ... Read More

Program to find number of starting point from where we can start travelling in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Oct-2021 07:13:46

483 Views

Suppose there are n cities numbered from 0 to n-1 and there are n directed roads. We can travel from city i to city (i + 1) % n [0 to 1 to 2 to .... to N - 1 to 0]. We have a car. The capacity of our ... Read More

Program to check robbers can rob the vault or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Oct-2021 07:11:05

124 Views

Suppose there are N number of robbers are trying to rob a vault. There was a guard but he went out for G amount of time, after that he will come back. And each robber has specific time to rob the vault, but at most two of them can enter ... Read More

Program to find maximum score of brick removal game in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Oct-2021 07:03:30

250 Views

Suppose Amal and Bimal are playing a game. They have an array nums which determines n bricks with numbered on top of it. In this game, players can alternatively remove one, two or three bricks from the top, and the numbers marked on the removed bricks are added to the ... Read More

Program to find winner of array removal game in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Oct-2021 07:00:23

213 Views

Suppose Amal and Bimal are playing a game where they have one array A with some numbers.The game rules are as followsBimal will start alwaysIn each turn one player deletes the maximum element from the array and all other elements present at right of the deleted element will also be ... Read More

Program to count number of possible humble matrices in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Oct-2021 06:56:58

175 Views

Suppose we have two values n and m. We have to find number of possible arrangements of humble matrices of order n x m. A matrix is said to be humble whenIt contains each element in range 1 to n x m exactly oncefor any two indices pairs (i1, j1) ... Read More

Program to find out the minimal cost so that the citizens have access to a market in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Oct-2021 06:53:04

304 Views

Suppose, there is n number of cities and m roads connecting the cities. The citizens of the people need markets where they can buy their commodities. Now, there are no markets in the cities, and the roads between the cities are under construction.A two-way road can be built between two ... Read More

Program to find out the minimum value from sum of node values of sub-trees in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Oct-2021 06:46:22

182 Views

Suppose, we have a tree that has all of its nodes numbered as 1 to n. Each of the nodes contains an integer value. Now if we remove an edge from the tree, the difference in the sum of the node values of the two sub-trees has to be minimal. ... Read More

Advertisements