上一页 1 2 3 4 5 6 7 8 ··· 12 下一页
摘要: 写在前面:这题和全排列不含重复元素的那题几乎一样,我比较垃圾,就用HashSet去掉了重复的元素但是看了九章算法的答案也没看懂,他写的很有感觉。用了hash,本来想着怎么写hashcode()和equal()方法的,哪知道都帮我写好了,Integer类型的元素存储在L... 阅读全文
posted @ 2018-08-08 16:47 wei1 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 学习了怎么写简单的递归DPS,没有去琢磨非递归import org.junit.Test;import java.util.ArrayList;import java.util.List;public class Permute { /** * @par... 阅读全文
posted @ 2018-08-08 15:06 wei1 阅读(79) 评论(0) 推荐(0) 编辑
摘要: TreeNodepublic class TreeNode { public int val; public TreeNode left, right; public TreeNode(int val) { this.val = val... 阅读全文
posted @ 2018-08-08 15:03 wei1 阅读(77) 评论(0) 推荐(0) 编辑
摘要: import java.util.ArrayList;import java.util.List;public class SearchRange { /** * 11. Search Range in Binary Search Tree * ... 阅读全文
posted @ 2018-08-08 15:00 wei1 阅读(72) 评论(0) 推荐(0) 编辑
摘要: public class StrStr { /** * @param source: source string to be scanned. * @param target: target string containing the seque... 阅读全文
posted @ 2018-08-08 14:58 wei1 阅读(100) 评论(0) 推荐(0) 编辑
摘要: import org.junit.Test;import java.util.Arrays;public class RotateString { /** * @param str: An array of char * @param offse... 阅读全文
posted @ 2018-08-08 14:55 wei1 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 第一种方法,用tree树排序,每次都排序import java.util.LinkedList;import java.util.TreeSet;public class MinStack1 { /** * 带最小值操作的栈 * 实现一个带有取最... 阅读全文
posted @ 2018-08-08 01:19 wei1 阅读(85) 评论(0) 推荐(0) 编辑
摘要: import org.junit.Test;import java.util.Arrays;public class MergeSort { /** * @param A: sorted integer array A * @param B: s... 阅读全文
posted @ 2018-08-07 23:05 wei1 阅读(75) 评论(0) 推荐(0) 编辑
摘要: import org.junit.Test;import java.util.*;public class KthLargestElement { /** * @param k : description of k * @param num... 阅读全文
posted @ 2018-08-07 23:04 wei1 阅读(72) 评论(0) 推荐(0) 编辑
摘要: //答案来源//[https://blog.csdn.net/surp2011/article/details/51168272](https://blog.csdn.net/surp2011/article/details/51168272)/** * 描述 * 设... 阅读全文
posted @ 2018-08-07 23:02 wei1 阅读(93) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 12 下一页