Python beat 98%


  • 0
    E

    class Solution(object):

    def matrixReshape(self, nums, r, c):
    	temp = [y for x in nums for y in x]
    	if (r*c) != len(temp):
    		return nums
    	else:
    		return map(list,zip(*([iter(temp)]*c)))

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.