code: def interleaving_strings_1(A, B, C):
      nA, nB, nC = len(A), len(B), len(C)
      if nA + nB != nC:
          return 0
  
      dp = [[0 for j in range(nB + 1)] for i in range(nA + 1)]
  
      # starting values
      dp[0][0] = 1
  
      for i in range(1, nA + 1):
          if A[i - 1] == C[i - 1]:
              # short form of if A[i - 1] == C[i - 1] and dp[i - 1][0] == 1
              # dp[i][0] and dp[0][1] can be only 0 or 1
              dp[i][0] = dp[i - 1][0]
  
      for i in range(1, nB + 1):
          if B[i - 1] == C[i - 1]:
              dp[0][i] = dp[0][i - 1]
  
      # run dp
      for i in range(1, nA + 1):
          for j in range(1, nB + 1):
              if A[i - 1] == C[i + j - 1]:
                  # look for the dp value from the previous position
                  dp[i][j] += dp[i - 1][j]
              if B[j - 1] == C[i + j - 1]:
                  # look for the dp value from the previous position
                  dp[i][j] += dp[i][j - 1]
  
      return dp[nA][nB]
  
label_desc: Use image node_id 1 for calling a global function with example usage: interleaving_strings_1(A, B, C) and returns: dp, int