上一页 1 ··· 104 105 106 107 108 109 110 111 112 ··· 114 下一页
摘要: public class Solution { public int SearchInsert(int[] nums, int target) { for (int i = 0; i < nums.Length; i++) { if (nums[i] >= target) { return i; } 阅读全文
posted @ 2017-04-19 11:42 Sempron2800+ 阅读(148) 评论(0) 推荐(0) 编辑
摘要: /** * Definition for singly-linked list. * public class ListNode { * public int val; * public ListNode next; * public ListNode(int x) { val = x; } * } 阅读全文
posted @ 2017-04-19 11:40 Sempron2800+ 阅读(162) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public bool IsPowerOfTwo(int n) { return ((n & (n - 1)) == 0 && n > 0); } } https://leetcode.com/problems/power-of-two/#/descr 阅读全文
posted @ 2017-04-19 11:39 Sempron2800+ 阅读(126) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/power-of-three/#/description 使用循环实现,python 阅读全文
posted @ 2017-04-19 11:38 Sempron2800+ 阅读(150) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/happy-number/#/description 补充一个python的实现: 使用集合s记录已经出现过的数字: 如果出现数字1,则返回True; 如果在出现重复的数字之前都没有出现过1,则返回False。 阅读全文
posted @ 2017-04-19 11:37 Sempron2800+ 阅读(150) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public int MaxProfit(int[] prices) { //寻找最优极值点(包括2个端点) if (prices.Length < 2) { return 0; } else if (prices.Length == 2) { ret 阅读全文
posted @ 2017-04-19 11:36 Sempron2800+ 阅读(177) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/convert-a-number-to-hexadecimal/#/description 阅读全文
posted @ 2017-04-19 11:35 Sempron2800+ 阅读(202) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/add-strings/#/description 阅读全文
posted @ 2017-04-19 11:33 Sempron2800+ 阅读(213) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/diameter-of-binary-tree/#/description 补充一种递归的方式,使用python实现: 思路是每次递归判断,以当前节点为根节点是否能达到最大,见第14行。 而每次递归向上返回的是当前节点的左右子树的高度的更大 阅读全文
posted @ 2017-04-19 11:32 Sempron2800+ 阅读(209) 评论(0) 推荐(0) 编辑
摘要: /** * Definition for a binary tree node. * public class TreeNode { * public int val; * public TreeNode left; * public TreeNode right; * public TreeNod 阅读全文
posted @ 2017-04-19 11:32 Sempron2800+ 阅读(126) 评论(0) 推荐(0) 编辑
上一页 1 ··· 104 105 106 107 108 109 110 111 112 ··· 114 下一页