## Chairs Requirement Solution Codechef

Chairs Requirement Solution Codechef Chef’s coding class is very famous in Chefland. This year X students joined his class and each student will require one chair to sit on. Chef already has Y chairs in his class. Determine the minimum number of new chairs Chef must buy so that every student is able to get one chair to sit … Read more

## Subscriptions Solution Codechef

Subscriptions Solution Codechef A new TV streaming service was recently started in Chefland called the Chef-TV. A group of N friends in Chefland want to buy Chef-TV subscriptions. We know that 6 people can share one Chef-TV subscription. Also, the cost of one Chef-TV subscription is X rupees. Determine the minimum total cost that the group of N friends will incur so that … Read more

## Divisible by i Solution Codechef

Divisible by i Solution Codechef You are given an integer N. Construct a permutation P of length N such that For all i (1≤i≤N-1), i divides abs(Pi+1​−Pi​). Recall that a permutation of length N is an array where every integer from 1 to N occurs exactly once. It can be proven that for the given constraints at least one such P always exists. Input Format Output Format Constraints Sample 1: Input 2 … Read more

## Reduce to zero Solution Codechef

Reduce to zero Solution Codechef Chef has two integers X and Y. Chef wants to perform some operations to make both X and Y zero simultaneously. In one operation, Chef can either: Chef is a little busy with preparing the contest. Help him find the minimum number of operations required to make both X and Y equal to 0 simultaneously. If it is impossible to do so after … Read more

## Full Path Eraser Solution Codechef

Full Path Eraser Solution Codechef There is a rooted tree of N vertices rooted at vertex 1. Each vertex v has a value Av​ associated with it. You choose a vertex v (possibly the root) from the tree and remove all vertices on the path from the root to the vertex v, also including v. This will result in a forest of zero or more connected … Read more