Please read the new rule regarding the restriction on the use of AI tools. ×

How to Solve this problem!! please help.

Revision en3, by arpit_aditya, 2023-09-30 09:10:11

Hey, fellow programmers. Hope you all are doing good.I don't want to waste your precious time so let's cut to the chase. As you can see I'm a newbie so pardon me if what i ask is way above my league. Believe me I'm trying but this competitive programming is difficult for me but sooner or later i will become good at this.

This was one of the questions asked in Amazon Hackathon round please help me solve this. Since I'm a newbie you can also share the links to article and knowledge resources that might be required to solve this. Please do not provide code directly as answer. Let me know how to solve and approach this problem.

The question is as follows-

/*****************************************

You are given N non negative integers namely-D1,D2,D3...DN. You have to find all the labelled trees that can be constructed such that the out-degrees of each vertex(1<=i<=N) is Dn. It is guaranteed that the sum of D1,D2....Dn is N-1.

Example test case- First line is number of integer and second line contains degree of each edges. Input- 4 0 1 0 2

Output- 5

A total of 5 labelled trees can be formed with given out-degrees.

Input-

5 0 1 1 1 1

Output- 125

A total of 125 labelled trees can be formed with given out-degrees. *************************************************************/

Tags problem solving, discussion, help

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en4 English arpit_aditya 2023-09-30 09:16:54 351
en3 English arpit_aditya 2023-09-30 09:10:11 2 Tiny change: 'ut-\n\n5\n0 1 1 1 ' -> 'ut-\n\n5\n\n0 1 1 1 '
en2 English arpit_aditya 2023-09-30 09:04:53 82
en1 English arpit_aditya 2023-09-30 06:36:57 1300 Initial revision (published)