上一页 1 ··· 103 104 105 106 107 108 109 110 111 ··· 114 下一页
摘要: https://leetcode.com/problems/repeated-substring-pattern/#/description 阅读全文
posted @ 2017-04-20 11:50 Sempron2800+ 阅读(98) 评论(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-20 11:17 Sempron2800+ 阅读(168) 评论(0) 推荐(0) 编辑
摘要: public class Solution { private bool Judge(int x) { if (x <= 1) { return false; } int bound = Convert.ToInt32(Math.Sqrt(x)); for (int i = 2; i <= boun 阅读全文
posted @ 2017-04-20 09:06 Sempron2800+ 阅读(91) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/binary-tree-level-order-traversal-ii/#/description 阅读全文
posted @ 2017-04-19 23:12 Sempron2800+ 阅读(92) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public int HammingWeight(uint n) { var list = new List<uint>(); do { var x = n % 2; list.Add(x); n = n / 2; } while (n != 0); 阅读全文
posted @ 2017-04-19 21:59 Sempron2800+ 阅读(103) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public int Reverse(int x) { int fuhao = 1; if (x < 0) { fuhao = -1; } try { x = Math.Abs(x); } catch (Exception e) { return 0; 阅读全文
posted @ 2017-04-19 11:53 Sempron2800+ 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 方案一:算法思想:两层循环。时间负责度:O(n^2),空间复杂度O(1)。代码使用C#实现: 1 public class Solution 2 { 3 public int[] TwoSum(int[] nums, int target) 4 { 5 var ary = new int[2]; 6 阅读全文
posted @ 2017-04-19 11:52 Sempron2800+ 阅读(1363) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/maximum-subarray/#/description 补充一个python的实现: 算法思路:贪心法。 阅读全文
posted @ 2017-04-19 11:47 Sempron2800+ 阅读(206) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public int ClimbStairs(int n) { //递归方法,效率低 //if (n <= 0) //{ // return 0; //} //else if (n == 1) //{ // return 1; //} //else i 阅读全文
posted @ 2017-04-19 11:46 Sempron2800+ 阅读(186) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/path-sum-iii/#/description 补充一个python实现,使用递归: 这种实现的时间复杂度是O(n^2),执行效率比较低。 再补充一个更高效的实现,使用hash表进行缓存:(如果必须符合这个时间复杂度的要求O(n),就 阅读全文
posted @ 2017-04-19 11:44 Sempron2800+ 阅读(135) 评论(0) 推荐(0) 编辑
上一页 1 ··· 103 104 105 106 107 108 109 110 111 ··· 114 下一页