摘要:
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 阅读全文
摘要:
https://leetcode.com/problems/count-primes/#/description 这道题目是意思是,计算比n小的非负数中有多少素数。 例如: n = 7,素数有2,3,5(不包含7)一共3个 n = 8,素数有2,3,5,7一共4个 使用素数筛法可以提高效率。 pyt 阅读全文
摘要:
https://leetcode.com/problems/third-maximum-number/#/description 阅读全文
摘要:
https://leetcode.com/problems/k-diff-pairs-in-an-array/#/description 阅读全文
摘要:
https://leetcode.com/problems/implement-strstr/#/description python实现,不实用内置函数: 作为一道easy题目,提交成功率只有33%,可以看出本题的一些细节需要仔细分析,否则很容易出错。 阅读全文
摘要:
public class MinStack { Stack<int> S = new Stack<int>(); /** initialize your data structure here. */ int min = int.MaxValue; public MinStack() { } pub 阅读全文
摘要:
https://leetcode.com/problems/range-sum-query-immutable/#/description 补充一个python的实现: 阅读全文
摘要:
public class Solution { public uint reverseBits(uint n) { var list = new List<uint>();//逆序的二进制列表,list[0]是最低位 while (n != 0) { var cur = n % 2; list.Ad 阅读全文
摘要:
https://leetcode.com/problems/heaters/#/description 阅读全文