title: Count Ofdifferent Ways Express N Sum 1 3 4
signature: func countOfdifferentWaysExpressNSum134(n int) int64 {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual int64, expected int64) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(n int, expected int64) string {
      if validateSolution(PLACEHOLDER_FN_NAME(n),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(44, 821223649)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(9, 40)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(19, 4895)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(10, 64)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(78, 10472279279564025)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(70, 222915410843904)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(81, 44361286907595736)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(81, 44361286907595736)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(49, 9107509825)
      fmt.Printf("TEST-8...%s\n", result)
      
          
  }
source_py: def count_ofdifferent_ways_express_n_sum_1_3_4(n):
      DP = [0 for i in range(0, (n + 1))]
      DP[0] = DP[1] = DP[2] = 1
      DP[3] = 2
      for i in range(4, (n + 1)):
          DP[i] = ((DP[(i - 1)] + DP[(i - 3)]) + DP[(i - 4)])
      return DP[n]
source_cpp: int count_ofdifferent_ways_express_n_sum_1_3_4(int n) {
    int DP [ n + 1 ];
    DP [ 0 ] = DP [ 1 ] = DP [ 2 ] = 1;
    DP [ 3 ] = 2;
    for ( int i = 4;
    i <= n;
    i ++ ) DP [ i ] = DP [ i - 1 ] + DP [ i - 3 ] + DP [ i - 4 ];
    return DP [ n ];
  }