input: Write a function to find the number of unique paths from a given source to a destination in a grid with dimensions m x n, where movements are restricted to right and down directions. If the grid size is 1x1, return 1. If either dimension is 0, return 0.
  
  def num_unique_paths(m, n):
      if m == 0 or n == 0:
          return 0
      if m == 1 and n == 1:
          return 1
      dp = [[0 for _ in range(m)] for _ in range(n)]
      for i in range(n):
          dp[i][0] = 1
      for j in range(m):
          dp[0][j] = 1
      for i in range(1, n):
          for j in range(1, m):
              dp[i][j] = dp[i-1][j] + dp[i][j-1]
      return dp[n-1][m-1]
  
  assert num_unique_paths(3, 2) == 3
  assert num_unique_paths(7, 3) == 28
  assert num_unique_paths(1, 1) == 1
  assert num_unique_paths(0, 5) == 0
  assert num_unique_paths(5, 0) == 0
output: def num_unique_paths(m, n):
      if m == 0 or n == 0:
          return 0
      if m == 1 and n == 1:
          return 1
      dp = [[0 for _ in range(m)] for _ in range(n)]
      for i in range(n):
          dp[i][0] = 1
      for j in range(m):
          dp[0][j] = 1
      for i in range(1, n):
          for j in range(1, m):
              dp[i][j] = dp[i-1][j] + dp[i][j-1]
      return dp[n-1][m-1]