title: Count Ofdifferent Ways Express N Sum 1 3 4
signature: function countOfdifferentWaysExpressNSum134(n: number): number {
test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value: any): string{
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual: number, expected: number): boolean {
      return convertToString(actual) === convertToString(expected);
  }
  
  function driver(n: number, expected:number): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(n),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver(44, 821223649);
    console.log(`TEST-0...${result}`);
  
    result = driver(9, 40);
    console.log(`TEST-1...${result}`);
  
    result = driver(19, 4895);
    console.log(`TEST-2...${result}`);
  
    result = driver(10, 64);
    console.log(`TEST-3...${result}`);
  
    result = driver(78, 10472279279564025);
    console.log(`TEST-4...${result}`);
  
    result = driver(70, 222915410843904);
    console.log(`TEST-5...${result}`);
  
    result = driver(81, 44361286907595736);
    console.log(`TEST-6...${result}`);
  
    result = driver(81, 44361286907595736);
    console.log(`TEST-7...${result}`);
  
    result = driver(49, 9107509825);
    console.log(`TEST-8...${result}`);
  
  };
  
  main();
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 ];
  }