上一页 1 2 3 4 5 6 ··· 27 下一页
摘要: 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)
摘要: Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character '.'.You may assume that there will be only one unique solution. A sudoku puzzle......and... 阅读全文
posted @ 2018-02-01 23:28 xiejunzhao 阅读(162) 评论(0) 推荐(0)
摘要: Given the root of a binary tree, then value v and depth d, you need to add a row of nodes with value v at the given depth d. The root node is at depth 1.The adding rule is: given a positive integer de... 阅读全文
posted @ 2018-02-01 23:27 xiejunzhao 阅读(152) 评论(0) 推荐(0)
摘要: You're given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how many of the sto... 阅读全文
posted @ 2018-01-29 22:40 xiejunzhao 阅读(939) 评论(0) 推荐(0)
摘要: Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers. Example 1:Input: k = 3, ... 阅读全文
posted @ 2018-01-29 22:39 xiejunzhao 阅读(162) 评论(0) 推荐(0)
摘要: Shuffle a set of numbers without duplicates. Example:// Init an array with set 1, 2, and 3. int[] nums = {1,2,3}; Solution solution = new Solution(nums); // Shuffle the array [1,2,3] and return its r... 阅读全文
posted @ 2018-01-23 21:52 xiejunzhao 阅读(172) 评论(0) 推荐(0)
摘要: Given a singly linked list, return a random node's value from the linked list. Each node must have the same probability of being chosen.Follow up: What if the linked list is extremely large and its le... 阅读全文
posted @ 2018-01-23 21:51 xiejunzhao 阅读(123) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 ··· 27 下一页