Transpose Matrix - Leetcode 867 - Python
Vložit
- čas přidán 24. 07. 2024
- 🚀 neetcode.io/ - A better way to prepare for Coding Interviews
🧑💼 LinkedIn: / navdeep-singh-3aaa14161
🥷 Discord: / discord
🐦 Twitter: / neetcode1
🐮 Support the channel: / neetcode
⭐ BLIND-75 PLAYLIST: • Two Sum - Leetcode 1 -...
💡 DYNAMIC PROGRAMMING PLAYLIST: • House Robber - Leetco...
Problem Link: leetcode.com/problems/transpo...
0:00 - Read the problem
0:30 - Drawing Explanation
3:57 - Coding Explanation
leetcode 867
#neetcode #leetcode #python
There's also a nice Pythonic one liner to transpose any matrix: list(zip(*matrix))
Also you could do inner list comprehension:
class Solution:
def transpose(self, matrix: List[List[int]]) -> List[List[int]]:
return [
[row[i] for row in matrix]
for i in range(len(matrix[0]))
]
Awesome
Can you do an explanation of LC 310 pls
I was asked this question in second year of my uni and I was among the only 3 people who solved it that time .... seeing it in Easy section makes me wonder how bad are my uni students....
the easy label is based of the accepted amounts of leetcode not the average population
really proof? i thought the company chose the diffculty@@cakesama9770