Graph Handshaking Lemma

Graph Handshaking Lemma

Easy Computer Mathematics Graph Theory Basics 32 views
Explanation Complexity

Problem Statement

Given degrees of all vertices, print YES if sum of degrees is even.

Input Format

n then n degrees.

Output Format

YES or NO.

Example

3
1 2 3
YES

Constraints

degrees>=0

Input / Output Format

Input Format
n then n degrees.
Output Format
YES or NO.
Constraints
degrees>=0

Examples

Input:
3 1 2 3
Output:
YES

Example Solution (Public)

Computer Mathematics
In any graph, sum of degrees = 2E, must be even. Check sum%2==0.

Official Solution Code

In any graph, sum of degrees = 2E, must be even. Check sum%2==0.
Please login to submit solutions.
Editor
Output

                                        
Please login to submit solutions.