专栏名称: 每日一道算法题
学习算法是一种信仰,每天都需要坚持!
目录
相关文章推荐
算法与数据结构  ·  京东算法全员将进行30%普调涨薪;01年实习 ... ·  2 天前  
算法与数据结构  ·  2024图灵奖颁给了强化学习之父Richar ... ·  2 天前  
九章算法  ·  谷歌豪掷$320亿收购Wiz!狗云员工恐被扫 ... ·  2 天前  
九章算法  ·  Intel面临破产危机!裁员50%断尾求生! ·  昨天  
九章算法  ·  「九点热评」亚麻裁去14000名mgr! ·  昨天  
51好读  ›  专栏  ›  每日一道算法题

[每日一题]498. Diagonal Traverse

每日一道算法题  · 公众号  · 算法  · 2017-11-01 22:10

正文

Given a matrix of M x N elements (M rows, N columns), return all elements of the matrix in diagonal order as shown in the below image.


Example:

Input:

[

[ 1, 2, 3 ],

[ 4, 5, 6 ],

[ 7, 8, 9 ]

]

Output:  [1,2,4,7,5,3,6,8,9]

Explanation:


Note:

The total number of elements of the given matrix will not exceed 10,000.


提示:提交代码后,需要用简洁的语言解释一下代码思路~ 谢谢


历史题目和总结见公众号「每日一道算法题」


https://leetcode.com/problems/diagonal-traverse/description/


小Fu视频讲解








请到「今天看啥」查看全文