- 博客(17)
- 资源 (3)
- 收藏
- 关注
原创 52. N-Queens II 回溯算法浅谈
Follow up for N-Queens problem. Now, instead outputting board configurations, return the total number of distinct solutions. Subscribe to see which companies asked this question 问题分析: 本题属于典型的回
2016-03-31 21:41:18 251
原创 92. Reverse Linked List II
Reverse a linked list from position m to n. Do it in-place and in one-pass. For example: Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3->2->5->NULL. Note: Given m, n satisfy the follo
2016-03-30 15:30:05 169
原创 337. House Robber III
The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides the root, each house has one and only one parent house. After a tour
2016-03-27 21:35:30 253
原创 338. Counting Bits
Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array. Example: For num = 5 y
2016-03-27 11:31:15 209
原创 171. Excel Sheet Column Number
Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding column number. For example: A -> 1 B -> 2 C -> 3 ... Z
2016-03-27 11:01:38 136
原创 1. Two Sum
Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution. Example: Given nums = [2,
2016-03-27 10:55:06 192
原创 47. Permutations II
Given a collection of numbers that might contain duplicates, return all possible unique permutations. For example, [1,1,2] have the following unique permutations: [1,1,2], [1,2,1], and [2,1,1].
2016-03-26 16:28:20 167
原创 50. Pow(x, n)
Implement pow(x, n). Subscribe to see which companies asked this question 解释: 递归求解,将复杂度降低。 代码: // #define DBL_MAX 1.7976931348623158e+308 /* max value */ // #define DBL_MIN 2.2250738585072014e
2016-03-26 14:33:37 252
原创 113. Path Sum II
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example: Given the below binary tree and sum = 22, 5 / \
2016-03-26 13:30:20 214
原创 17. Letter Combinations of a Phone Number
Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) is given below. Input:Digit string
2016-03-26 12:49:04 184
原创 103. Binary Tree Zigzag Level Order Traversal
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between). For example: Given binary tr
2016-03-26 12:19:50 223
原创 16. 3Sum Closest
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly
2016-03-26 10:57:53 257
原创 106. Construct Binary Tree from Inorder and Postorder Traversal
Given inorder and postorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the tree. Subscribe to see which companies asked this question 分析
2016-03-26 09:55:05 187
原创 105. Construct Binary Tree from Preorder and Inorder Traversal
Given preorder and inorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the tree. Subscribe to see which companies asked this question 分析:
2016-03-26 09:06:40 365
原创 189. Rotate Array
Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. Note: Try to come up as many solutions as you ca
2016-03-25 13:44:51 203
原创 236. Lowest Common Ancestor of a Binary Tree
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two nodes
2016-03-24 22:21:57 196
原创 330. Patching Array
Given a sorted positive integer array nums and an integer n, add/patch elements to the array such that any number in range [1, n] inclusive can be formed by the sum of some elements in the array. Ret
2016-03-24 20:56:19 273
python xlrd3 安装包 用于python3以后的版本
2016-07-27
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人