title: Count Possible Paths Top Left Bottom Right Nxm Matrix 2
signature: func countPossiblePathsTopLeftBottomRightNxmMatrix2(p int, q 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(p int, q int, expected int64) string {
      if validateSolution(PLACEHOLDER_FN_NAME(p, q),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(70, 
  	5, 1088430)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(9, 
  	59, 5743572120)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(54, 
  	1, 1)
      fmt.Printf("TEST-2...%s\n", result)
      
          
  }
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 ];
    }