parameters: (self, rowSum, colSum)
return_statement: return matrix
docstring: :type rowSum: List[int]
          :type colSum: List[int]
          :rtype: List[List[int]]
docstring_summary: :type rowSum: List[int]
          :type colSum: List[int]
          :rtype: List[List[int]]
docstring_tokens: : type rowSum : List [ int ] : type colSum : List [ int ] : rtype : List [ List [ int ]]
function: def restoreMatrix(self, rowSum, colSum):
          """
          :type rowSum: List[int]
          :type colSum: List[int]
          :rtype: List[List[int]]
          """
          matrix = [[0]*len(colSum) for _ in xrange(len(rowSum))]
          i = j = 0
          while i < len(matrix) and j < len(matrix[0]):
              matrix[i][j] = min(rowSum[i], colSum[j])  # greedily used
              rowSum[i] -= matrix[i][j]
              colSum[j] -= matrix[i][j]
              if not rowSum[i]:  # won't be used in row i, ++i
                  i += 1
              if not colSum[j]:  # won't be used in col j, ++j
                  j += 1
          return matrix
function_tokens: def restoreMatrix ( self , rowSum , colSum ) : matrix = [ [ 0 ] * len ( colSum ) for _ in xrange ( len ( rowSum ) ) ] i = j = 0 while i < len ( matrix ) and j < len ( matrix [ 0 ] ) : matrix [ i ] [ j ] = min ( rowSum [ i ] , colSum [ j ] ) # greedily used rowSum [ i ] -= matrix [ i ] [ j ] colSum [ j ] -= matrix [ i ] [ j ] if not rowSum [ i ] : # won't be used in row i, ++i i += 1 if not colSum [ j ] : # won't be used in col j, ++j j += 1 return matrix