title: Check Whether Given Degrees Vertices Represent Graph Tree
signature: checkWhetherGivenDegreesVerticesRepresentGraphTree :: [Integer] -> Integer -> Bool
  checkWhetherGivenDegreesVerticesRepresentGraphTree degree n = 
test_code: import Text.Printf
  import Control.Exception (catch, SomeException)
  import Data.Typeable
  import qualified Data.List as List
  import qualified Data.Map as Map
  import qualified Data.Set as Set
  
  -- SOLUTION CODE
  -- ============================================
  
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  validateSolution :: Bool -> Bool -> Bool
  validateSolution actual expected = do
      actual == expected
  
  
  driver :: [Integer] -> Integer -> Bool -> String
  driver degree n expected = do
      if (validateSolution (PLACEHOLDER_FN_NAME degree n) expected)
          then "PASSED"
      else "FAILED"
  
  main = do
      printf "TEST-0...%s\n" (driver ([2, 3, 1, 1, 1]) (5) (True) )
  
      printf "TEST-1...%s\n" (driver ([2, 2, 1, 1, 2]) (5) (True) )
  
      printf "TEST-2...%s\n" (driver ([2, 2, 1, 1, 1]) (5) (False) )
  
      printf "TEST-3...%s\n" (driver ([0, 0, 0, 3, 3, 4]) (6) (True) )
  
      printf "TEST-4...%s\n" (driver ([-10, 12, 2]) (3) (True) )
  
      printf "TEST-5...%s\n" (driver ([1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0]) (19) (False) )
  
      printf "TEST-6...%s\n" (driver ([1, 6, 10, 13, 15, 17, 18, 23, 26, 28, 30, 32, 32, 33, 36, 39, 39, 41, 43, 50, 50, 51, 53, 54, 59, 59, 63, 63, 63, 66, 66, 71, 71, 74, 78, 89, 89, 93]) (30) (False) )
  
      printf "TEST-7...%s\n" (driver ([66, -96, -14, 74, -20]) (4) (False) )
  
      printf "TEST-8...%s\n" (driver ([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) (31) (False) )
  
      printf "TEST-9...%s\n" (driver ([97, 73, 87, 45, 64, 30, 53, 50, 62, 42, 28, 58, 31, 90]) (10) (False) )
  
source_py: def check_whether_given_degrees_vertices_represent_graph_tree(degree, n):
      deg_sum = sum(degree)
      if ((2 * (n - 1)) == deg_sum):
          return True
      else:
          return False
source_cpp: bool check_whether_given_degrees_vertices_represent_graph_tree(vector<int> degree, int n) {
    int deg_sum = 0;
    for ( int i = 0;
    i < n;
    i ++ ) deg_sum += degree [ i ];
    return ( 2 * ( n - 1 ) == deg_sum );
  }