今天看啥  ›  专栏  ›  每日一道算法题

[每日一题]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视频讲解 ………………………………

原文地址:访问原文地址
快照地址: 访问文章快照