title: Possible To Make A Divisible By 3 Number Using All Digits In An Array
signature: func possibleToMakeADivisibleBy3NumberUsingAllDigitsInAnArray(arr []int, n int) bool {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual bool, expected bool) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(arr []int, n int, expected bool) string {
      if validateSolution(PLACEHOLDER_FN_NAME(arr, n),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver([]int{2, 4, 9, 11, 12, 15, 16, 19, 21, 21, 23, 23, 24, 30, 31, 31, 32, 34, 37, 41, 41, 43, 45, 46, 47, 54, 58, 60, 62, 66, 66, 74, 74, 75, 75, 77, 77, 85, 89, 90, 92, 92, 93, 95, 98}, 
  	30, false)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver([]int{0, 66, 92, 24, -8, 88, -92, 86, 80, 82, 42, -20, -56, -2, -84, 32}, 
  	14, false)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver([]int{0, 0, 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}, 
  	29, true)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver([]int{99, 83, 11, 99, 80, 76, 32, 12, 94, 66, 76}, 
  	5, true)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver([]int{-88, -84, -80, -80, -80, -80, -72, -68, -64, -62, -60, -52, -48, -44, -36, -24, -20, -18, -14, -8, -6, -6, -4, 6, 10, 14, 18, 24, 26, 26, 50, 50, 52, 60, 76, 90, 96, 98}, 
  	19, true)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver([]int{0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1}, 
  	14, false)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver([]int{6, 6, 8, 8, 10, 24, 24, 26, 27, 30, 34, 34, 36, 36, 39, 40, 41, 44, 45, 50, 52, 53, 57, 62, 64, 64, 70, 71, 72, 78, 78, 79, 80, 82, 89, 95, 96}, 
  	28, false)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver([]int{-28, -84, -14, -20, -14, -26, 28, -66, 48, 82, -46, -10, -94, 76, 56, -6, 72, -92, -32, 66, 50, -72, 64, 12, 48, 88, -36, -12, -6, -18, -36, -34, 44, 40, -54}, 
  	25, false)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver([]int{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}, 
  	19, false)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver([]int{17, 47, 89, 75, 57, 69, 70, 57, 83, 79, 57, 49}, 
  	8, false)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
source_py: def possible_to_make_a_divisible_by_3_number_using_all_digits_in_an_array(arr, n):
      remainder = 0
      for i in range(0, n):
          remainder = ((remainder + arr[i]) % 3)
      return (remainder == 0)
source_cpp: bool possible_to_make_a_divisible_by_3_number_using_all_digits_in_an_array(vector<int> arr, int n) {
    int remainder = 0;
    for ( int i = 0;
    i < n;
    i ++ ) remainder = ( remainder + arr [ i ] ) % 3;
    return ( remainder == 0 );
  }