上一页 1 ··· 6 7 8 9 10 11 12 下一页
  2017年8月8日
摘要: 1 50 Power(x, n) 1 确定n正负 2 结果正负 3 二分 public double myPow(double x, int n) { if (n == 0) return 1.0; double res = 1.0; if (n < 0) { if (x < 1 / Double. 阅读全文
posted @ 2017-08-08 10:05 wheleetcode 阅读(144) 评论(0) 推荐(0)
  2017年8月3日
摘要: 1 leetCode 273 Integer to English Words 思路 三个数一起,分3个特殊数组 1 public class Solution { 2 private final String[] LESS_THAN_20 = {"", "One", "Two", "Three", 阅读全文
posted @ 2017-08-03 09:42 wheleetcode 阅读(174) 评论(0) 推荐(0)
  2017年6月26日
摘要: 1.问题 np完全问题 ,给定一组物品,每个都有自己的重量和价格,在限定的总重量内,如何选择使物品的总价格最高 2 基础背包 N个物品和容量为V的背包,每个物品的重量为w[i] 价值为v[i],求装那些物品可以不超过背包容量且价值最大 递推公式 f[i][v] = max( f[i-1][v], f 阅读全文
posted @ 2017-06-26 14:27 wheleetcode 阅读(102) 评论(0) 推荐(0)
  2017年6月17日
摘要: 第一周 三角形个数。 public int triangleCount(int s[]) { // write your code here if (s == null || s.length == 0) return 0; int res = 0; Arrays.sort(s); for (int 阅读全文
posted @ 2017-06-17 15:06 wheleetcode 阅读(135) 评论(0) 推荐(0)
  2017年6月15日
摘要: 7 序列和反序列话 class Solution { /** * This method will be invoked first, you should design your own algorithm * to serialize a binary tree which denote by 阅读全文
posted @ 2017-06-15 14:48 wheleetcode 阅读(114) 评论(0) 推荐(0)
摘要: 1 11 搜索区间 public ArrayList<Integer> searchRange(TreeNode root, int k1, int k2) { // write your code here ArrayList<Integer> res = new ArrayList<>(); h 阅读全文
posted @ 2017-06-15 14:08 wheleetcode 阅读(86) 评论(0) 推荐(0)
  2017年6月14日
摘要: 一 克隆图 广搜 133 Clone Graph public UndirectedGraphNode cloneGraph(UndirectedGraphNode node) { if (node == null) return node; LinkedList<UndirectedGraphNo 阅读全文
posted @ 2017-06-14 11:17 wheleetcode 阅读(77) 评论(0) 推荐(0)
  2017年6月13日
摘要: 201一 线段树的构造 /** * Definition of SegmentTreeNode: * public class SegmentTreeNode { * public int start, end; * public SegmentTreeNode left, right; * pub 阅读全文
posted @ 2017-06-13 15:25 wheleetcode 阅读(94) 评论(0) 推荐(0)
  2017年6月12日
摘要: 一 普通字典树 208 1, 实现字典树 class TrieNode { // Initialize your data structure here. private TrieNode[] children; public boolean hasWord; public TrieNode() { 阅读全文
posted @ 2017-06-12 14:34 wheleetcode 阅读(110) 评论(0) 推荐(0)
  2017年5月14日
摘要: 1 239 Sliding Window Maximun 双端队列 public int[] maxSlidingWindow(int[] nums, int k) { if (nums == null || k <= 0) return new int[0]; int n = nums.lengt 阅读全文
posted @ 2017-05-14 10:03 wheleetcode 阅读(113) 评论(0) 推荐(0)
上一页 1 ··· 6 7 8 9 10 11 12 下一页