Question: INPUT: 9 3 1 2 2 4 4 4 3 1 OUTPUT: 4 aabbbbbba SOLVE THIS PROBLEM IN C++ Kilani and Abd are neighbors for

 INPUT: 9 3 1 2 2 4 4 4 3 1

INPUT: 9 3 1 2 2 4 4 4 3 1

OUTPUT: 4 aabbbbbba

OUTPUT: 4 aabbbbbba SOLVE THIS PROBLEM IN C++ Kilani and Abd are

neighbors for 3000 years, but then the day came and Kilani decided

SOLVE THIS PROBLEM IN C++

Kilani and Abd are neighbors for 3000 years, but then the day came and Kilani decided to move to another house. As a farewell gift, Kilani is going to challenge Abd with a problem written by their other neighbor with the same name Abd. The problem is: . You are given a connected tree rooted at node 1. You should assign a character a orb to every node in the tree so that the total number of a's is equal to x and the total number of b's is equal to n-3 Let's define a string for each node v of the tree as follows: if v is root then the string is just one character assigned to v. otherwise, let's take a string defined for the u's parent P, and add to the end of it a character assigned to v. You should assign every node a character in a way that minimizes the number of distinct strings among the strings of all nodes. Input The first line contains two integers n and 2 (1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!