摘要: There is a brick wall in front of you. The wall is rectangular and has several rows of bricks. The bricks have the same height but different width. You want to draw a vertical line from the top to t... 阅读全文
posted @ 2018-02-05 23:21 xiejunzhao 阅读(189) 评论(0) 推荐(0)
摘要: 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 ] ] Ou... 阅读全文
posted @ 2018-02-05 23:19 xiejunzhao 阅读(484) 评论(0) 推荐(0)
摘要: Given a binary tree, return the preorder traversal of its nodes' values. For example: Given binary tree [1,null,2,3], 1 \ 2 / 3 return [1,2,3]. Note: Recursive solution is trivial, ... 阅读全文
posted @ 2018-02-05 23:18 xiejunzhao 阅读(224) 评论(0) 推荐(0)
摘要: Given a collection of distinct numbers, return all possible permutations. For example,[1,2,3] have the following permutations:[ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1] ] cla... 阅读全文
posted @ 2018-02-05 23:17 xiejunzhao 阅读(140) 评论(0) 推荐(0)