Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

Help needed for solving this problem based on graph

$
0
0

Given am array of N integers is it possible to design a simple graph of N vertices?.

A graph considered simple if it has no self-loop r multi-edges. The condition is that each element of array should be used exactly once for degrees of vertices of the graph.

Print Yes if graph can be designed other wise no.

INPUT

A single integer T, in the first line, denoting the no. of test cases.

For each test case first line is a single integer N, denoting the no. of elements of an array A.

The second line contains N space separated integers denoting the elements of an array.

OUTPUT

For each test case print "YES" or "NO" without quotes.

SAMPLE INPUT

3

2

1 1

3

1 2 1

3

1 1 1

SAMPLE OUTPUT

YES

YES

NO


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>