上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 36 下一页
摘要: 你和你的朋友面前有一排石头堆,用一个数组 piles 表示,piles[i] 表示第 i 堆石子有多少个。你们轮流拿石头,一次拿一堆,但是只能拿走最左边或者最右边的石头堆。所有石头被拿完后,谁拥有的石头多,谁获胜。 石头的堆数可以是任意正整数,石头的总数也可以是任意正整数,这样就能打破先手必胜的局面 阅读全文
posted @ 2020-07-24 14:06 使用D 阅读(257) 评论(0) 推荐(0)
摘要: public static void main(String[] args) { try { LRUStruct lruStruct = new LRUStruct(4); lruStruct.put("1", 1); lruStruct.put("2", 2); lruStruct.put("3" 阅读全文
posted @ 2020-07-15 18:06 使用D 阅读(269) 评论(0) 推荐(0)
摘要: 算法参考:https://mp.weixin.qq.com/s?__biz=MzAxODQxMDM0Mw==&mid=2247484482&idx=1&sn=9503dae2ec50bc8aa2ba96af11ea3311&source=41#wechat_redirect 备忘录算 阅读全文
posted @ 2020-07-15 16:02 使用D 阅读(214) 评论(0) 推荐(0)
摘要: 算法参考:https://mp.weixin.qq.com/s?__biz=MzAxODQxMDM0Mw==&mid=2247484482&idx=1&sn=9503dae2ec50bc8aa2ba96af11ea3311&source=41#wechat_redirect publ 阅读全文
posted @ 2020-07-15 14:34 使用D 阅读(239) 评论(0) 推荐(0)
摘要: if (p.hash == hash && ((k = p.key) == key || (key != null && key.equals(k)))) 源码中为什么使用了equals判断相等后,同时需要判断hash码是否相同? 这里需要注意的是key可以使对象即Object类型的,也可以是Lon 阅读全文
posted @ 2020-07-15 00:08 使用D 阅读(1750) 评论(2) 推荐(0)
摘要: static class Node { private Node next; private int val; public Node(Node next, int val) { this.next = next; this.val = val; } } public static void mai 阅读全文
posted @ 2020-07-14 22:08 使用D 阅读(211) 评论(0) 推荐(0)
摘要: 参考ArrayBlockingQueue import java.util.ArrayList; import java.util.List; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks 阅读全文
posted @ 2020-07-14 20:53 使用D 阅读(166) 评论(0) 推荐(0)
摘要: public static int a() { int target = 6; int[] a = {3, 3, 1, 3, 3, 7, -1}; int[] dp = new int[a.length + 1]; //初始化 dp[0] = 0; for (int i = 1; i < dp.le 阅读全文
posted @ 2020-07-14 10:42 使用D 阅读(224) 评论(0) 推荐(0)
摘要: public static void main(String[] args) { int[] a = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int startI = 0; int endI = a.length - 1; while (startI <= endI) { 阅读全文
posted @ 2020-07-14 00:36 使用D 阅读(166) 评论(0) 推荐(0)
摘要: public static void main(String[] args) { int target = 10; int[] a = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int startI = 0; int endI = a.length - 1; while (s 阅读全文
posted @ 2020-07-14 00:34 使用D 阅读(157) 评论(0) 推荐(0)
上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 36 下一页