title: Find Maximum Dot Product Two Arrays Insertion 0S
signature: find_maximum_dot_product_two_arrays_insertion_0s <- function(a, b, m, n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(a, b, m, n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(a, b, m, n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          list(7L, 9L, 22L, 68L), list(14L, 22L, 54L, 58L), 3L, 2L, 
          610L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(24L, 40L, 98L, 58L, -24L, 24L, 76L, 48L, -92L, -16L, -46L, -48L, -70L, 88L, 66L, 2L, 44L, 36L, 34L, 34L, 46L, 90L, -80L, -24L, -58L, 68L, 72L, -20L, -62L, -40L), list(30L, -88L, 6L, -26L, -76L, 14L, -80L, -30L, -58L, 76L, 40L, -28L, -54L, 38L, -60L, -60L, 88L, -80L, -22L, 90L, 50L, -48L, 68L, -26L, 26L, -2L, 68L, -16L, 88L, -72L), 22L, 22L, 
          7952L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 22L, 19L, 
          0L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(32L, 15L, 41L, 41L, 4L, 42L, 22L, 33L, 33L, 11L, 68L, 5L, 41L, 80L, 39L, 15L, 36L, 75L, 41L, 11L, 25L, 40L, 50L, 19L, 39L, 12L, 75L, 28L, 52L, 20L, 63L, 5L, 27L, 53L, 19L, 62L, 98L, 72L, 10L, 90L, 74L, 93L, 52L, 81L, 91L, 65L, 90L, 93L), list(80L, 18L, 9L, 29L, 62L, 89L, 4L, 40L, 47L, 15L, 35L, 82L, 22L, 97L, 63L, 54L, 7L, 58L, 64L, 73L, 54L, 79L, 21L, 21L, 20L, 19L, 56L, 42L, 6L, 97L, 7L, 34L, 55L, 35L, 57L, 86L, 73L, 88L, 20L, 29L, 48L, 52L, 8L, 77L, 2L, 12L, 6L, 47L), 30L, 25L, 
          50904L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-94L, -76L, -68L, -50L, -28L, -20L, 18L, 24L, 30L, 54L, 74L, 84L, 98L), list(-88L, -80L, -78L, -68L, -44L, -38L, 42L, 50L, 62L, 68L, 70L, 80L, 92L), 11L, 8L, 
          31016L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 0L, 0L, 1L, 1L, 0L, 1L, 1L, 1L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 1L, 1L, 1L, 0L, 1L, 0L), list(1L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 1L, 1L, 0L, 1L, 1L, 0L, 0L, 1L, 0L, 1L, 1L, 0L, 1L, 0L, 1L, 1L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L), 21L, 33L, 
          0L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(14L, 27L, 43L, 49L), list(51L, 59L, 76L, 83L), 2L, 2L, 
          2307L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(78L, -26L, -12L, 38L, -90L), list(14L, 50L, -6L, -38L, 80L), 3L, 2L, 
          492L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          list(0L, 1L, 1L, 1L), list(0L, 0L, 0L, 1L), 3L, 2L, 
          0L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(12L, 69L, 57L, 7L, 52L, 14L, 15L, 83L, 67L, 57L, 15L, 86L, 81L, 43L, 1L, 64L, 45L, 68L, 30L, 23L, 14L, 70L, 13L, 51L, 23L, 33L, 98L, 68L, 24L, 43L, 12L, 82L, 46L), list(12L, 48L, 57L, 40L, 47L, 36L, 22L, 50L, 68L, 98L, 77L, 78L, 39L, 55L, 87L, 75L, 65L, 27L, 33L, 27L, 70L, 34L, 67L, 71L, 84L, 33L, 7L, 61L, 3L, 9L, 67L, 92L, 60L), 17L, 32L, 
          0L
      )))
  
  }
  
  main()
source_py: def find_maximum_dot_product_two_arrays_insertion_0s(A, B, m, n):
      dp = [[0 for i in range((m + 1))] for j in range((n + 1))]
      for i in range(1, (n + 1), 1):
          for j in range(i, (m + 1), 1):
              dp[i][j] = max((dp[(i - 1)][(j - 1)] + (A[(j - 1)] * B[(i - 1)])), dp[i][(j - 1)])
      return dp[n][m]
source_cpp: long long int find_maximum_dot_product_two_arrays_insertion_0s(vector<int> A, vector<int> B, int m, int n) {
    long long int dp [ n + 1 ] [ m + 1 ];
    memset ( dp, 0, sizeof ( dp ) );
    for ( int i = 1;
    i <= n;
    i ++ ) for ( int j = i;
    j <= m;
    j ++ ) dp [ i ] [ j ] = max ( ( dp [ i - 1 ] [ j - 1 ] + ( A [ j - 1 ] * B [ i - 1 ] ) ), dp [ i ] [ j - 1 ] );
    return dp [ n ] [ m ];
  }