Leetcode - Reshape the Matrix (Python)

preview_player
Показать описание
July 2021 Leetcode Challenge
Leetcode - Reshape the Matrix #566
Difficulty: Easy
Рекомендации по теме
Комментарии
Автор

thank you. great explanation love the [k//c][k%c] trick

slymastera
Автор

your videos been helping a ton thanks!!

pravanw.
Автор

Great solution so easy to understand, thanks!

nama
Автор

I am trying to understand what thought process led you to create a zero-filled output matrix?

deeprony
Автор

This is how I did it

currentRow = 0
currentCol = 0
for i in range(m):
for j in range(n):
if currentCol == c:
currentRow += 1
currentCol = 0
= mat[i][j]
currentCol += 1

varuntyagi