this is my python solution


  • 0
    D
        tmp = []
        list_t = []
        for i in nums:
            tmp.extend(i)
        s = len(tmp)
        if s < r * c:
            return nums
        else:
            for i in range(r):
                t = []
                s = i * c
                t.extend(tmp[s:(i+1)*c])
                list_t.append(t)
            return list_t
    

    maybe it's simple to understand


Log in to reply
 

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