摘要:
public class Solution { public int MySqrt(int x) { long r = x; while (r * r > x) r = (r + x / r) / 2; return (int)r; } } https://leetcode.com/problems 阅读全文
posted @ 2017-04-26 18:58
Sempron2800+
阅读(214)
评论(0)
推荐(0)
摘要:
https://leetcode.com/problems/count-primes/#/description 这道题目是意思是,计算比n小的非负数中有多少素数。 例如: n = 7,素数有2,3,5(不包含7)一共3个 n = 8,素数有2,3,5,7一共4个 使用素数筛法可以提高效率。 pyt 阅读全文
posted @ 2017-04-26 18:50
Sempron2800+
阅读(128)
评论(0)
推荐(0)
摘要:
https://leetcode.com/problems/third-maximum-number/#/description 阅读全文
posted @ 2017-04-26 18:14
Sempron2800+
阅读(106)
评论(0)
推荐(0)
摘要:
https://leetcode.com/problems/k-diff-pairs-in-an-array/#/description 阅读全文
posted @ 2017-04-26 18:04
Sempron2800+
阅读(92)
评论(0)
推荐(0)
摘要:
https://leetcode.com/problems/implement-strstr/#/description python实现,不实用内置函数: 作为一道easy题目,提交成功率只有33%,可以看出本题的一些细节需要仔细分析,否则很容易出错。 阅读全文
posted @ 2017-04-26 17:27
Sempron2800+
阅读(111)
评论(0)
推荐(0)
摘要:
public class MinStack { Stack<int> S = new Stack<int>(); /** initialize your data structure here. */ int min = int.MaxValue; public MinStack() { } pub 阅读全文
posted @ 2017-04-26 17:22
Sempron2800+
阅读(129)
评论(0)
推荐(0)
摘要:
https://leetcode.com/problems/range-sum-query-immutable/#/description 补充一个python的实现: 阅读全文
posted @ 2017-04-26 16:51
Sempron2800+
阅读(102)
评论(0)
推荐(0)
摘要:
public class Solution { public uint reverseBits(uint n) { var list = new List<uint>();//逆序的二进制列表,list[0]是最低位 while (n != 0) { var cur = n % 2; list.Ad 阅读全文
posted @ 2017-04-26 16:32
Sempron2800+
阅读(120)
评论(0)
推荐(0)
摘要:
https://leetcode.com/problems/heaters/#/description 阅读全文
posted @ 2017-04-26 16:16
Sempron2800+
阅读(143)
评论(0)
推荐(0)
浙公网安备 33010602011771号