title: Count Possible Paths Top Left Bottom Right Nxm Matrix 2
signature: count_possible_paths_top_left_bottom_right_nxm_matrix_2 <- function(p, q) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(p, q, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(p, q), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          70L, 5L, 
          1088430L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          9L, 59L, 
          5743572120L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          54L, 1L, 
          1L
      )))
  
  }
  
  main()
source_py: def count_possible_paths_top_left_bottom_right_nxm_matrix_2(p, q):
      dp = [1 for i in range(q)]
      for i in range((p - 1)):
          for j in range(1, q):
              dp[j] += dp[(j - 1)]
      return dp[(q - 1)]
source_cpp: int count_possible_paths_top_left_bottom_right_nxm_matrix_2(int m, int n) {
    int dp [ n ] = {
      1 };
      dp [ 0 ] = 1;
      for ( int i = 0;
      i < m;
      i ++ ) {
        for ( int j = 1;
        j < n;
        j ++ ) {
          dp [ j ] += dp [ j - 1 ];
        }
      }
      return dp [ n - 1 ];
    }