- 博客(21)
- 收藏
- 关注
原创 最长重复子串
class Solution { long mod = (long)Math.pow(2, 37) - 1; long a = 26; int nums[]; int n; public String longestDupSubstring(String S) { nums = new int [S.length()]; for (int i = 0; i < S.length(); i ++) { num
2020-10-21 20:12:08
161
原创 前缀树
class Trie { TrieNode root; /** Initialize your data structure here. */ public Trie() { root = new TrieNode(); } /** Inserts a word into the trie. */ public void insert(String word) { TrieNode cur = root;
2020-10-15 20:37:59
113
原创 前缀树
class Trie { private final int SIZE = 26; private TrieNode root; // TrieNode class TrieNode { // 多少单词通过这个节点,即由根至该节点组成的字符串模式出现的次数 private int num; // 所有的儿子节点 private TrieNode[] son; // 是不是最后一个节点
2020-10-15 20:31:10
135
原创 前缀树
在这里插class Trie { private final int ALPHABET_SIZE = 26; private Trie[] children = new Trie[ALPHABET_SIZE]; boolean isEndOfWord = false; public Trie() {} public void insert(String word) { Trie tmp = this; for (char i
2020-10-15 20:27:02
103
原创 2020-09-26
class Solution { public int tilingRectangle(int n, int m) { int INF = 0x3f3f3f3f; int[][] dp = new int[n + 1][m + 1]; for(int i = 1; i <= n; i++){ for(int j = 1; j <= m; j++){ //如果是正方形
2020-09-26 20:02:14
86
原创 2020-09-23
// javaclass Solution { public int longestCommonSubsequence(String text1, String text2) { int m = text1.length(), n = text2.length(); int[][] dp = new int[m + 1][n + 1]; for (int i = 0; i < m; i++) { for (int j
2020-09-23 19:39:09
74
原创 2020-09-18
import java.util.ArrayDeque;import java.util.ArrayList;import java.util.Arrays;import java.util.Deque;import java.util.List;public class Solution { public List<List<Integer>> combinationSum(int[] candidates, int target) { int
2020-09-18 18:57:04
152
原创 2020-09-15
class Solution { private class LargerNumberComparator implements Comparator<String> { @Override public int compare(String a, String b) { String order1 = a + b; String order2 = b + a; return order
2020-09-15 17:09:24
81
原创 2020-09-15
class Solution { private class LargerNumberComparator implements Comparator<String> { @Override public int compare(String a, String b) { String order1 = a + b; String order2 = b + a; return order2.com
2020-09-15 17:08:53
89
原创 2020-09-14
class Solution { public String rearrangeString(String s, int k) { if(s == null || s.length() == 0){ return s; } HashMap<Character, Integer> hm = new Integer>(); for(int i = 0; i<s.length(); i++){
2020-09-14 20:53:21
91
原创 2020-09-14
class Solution { public double[] medianSlidingWindow(int[] nums, int k) { double[] result = new double[nums.length - k + 1]; if (k == 1) { for (int i = 0; i < result.length; i ++) { result[i] = (double) nu
2020-09-14 19:48:04
86
原创 2020-09-13
class Solution { public List<List<Integer>> threeSum(int[] nums) { Arrays.sort(nums); List<List<Integer>> res = new ArrayList<>(); for(int k = 0; k < nums.length - 2; k++){ if(nums[k]
2020-09-13 16:19:37
111
原创 2020-09-09
class Solution { public boolean exist(char[][] board, String word) { boolean[][] visited = new boolean[board.length][board[0].length]; for (int i = 0; i < board.length; i++) { for (int j = 0; j < board[0].length; j++)
2020-09-09 20:19:41
111
原创 2020-09-09
class Solution {public boolean exist(char[][] board, String word) {boolean[][] visited = new boolean[board.length][board[0].length];for (int i = 0; i < board.length; i++) {for (int j = 0; j < board[0].length; j++) {if (word.charAt(0) == board[i]
2020-09-09 20:17:52
81
原创 2020-09-09
class Solution { public List<List<Integer>> pacificAtlantic(int[][] matrix) { List<List<Integer>> res = new ArrayList<>(); if(matrix == null || matrix.length == 0){ return res; }
2020-09-09 19:17:20
141
原创 IDEA快捷键
idea常用的快捷键Alt+回车 导入包,自动修正Ctrl+N 查找类Ctrl+Shift+N 查找文件Ctrl+Alt+L 格式化代码Ctrl+Alt+O 优化导入的类和包Alt+Insert 生成代码(如get,set方法,构造函数等)Ctrl+E或者Alt+Shift+C 最近更改的代码Ctrl+R 替换文本Ctrl+F 查找文本Ctrl+Shift+Space 自动补全代码Ctrl+空格 代码提示Ctrl+Alt+Space 类名或接口名提示Ctrl+P 方法参数提
2020-07-30 16:28:54
111
原创 使用junit测试,找不到org.junit,/hamcrest/SelfDescribing错误
总结一下自己的心路历程。1.按照https://www.cnblogs.com/qinxu/p/7844964.html步骤按照了junit相关插件如果像我这样没有browse repository在下面,直接在搜索框里搜一下,然后再搜索junit,就能找到了2.报错。说找不到org.junithttps://blog.youkuaiyun.com/he99774/article/details/782542622.报java.lang.NoClassDefFoundError: org/hamcrest/
2020-07-02 10:39:33
652
原创 牛客网 剑指offer出现 cannot find symbol的解决方法
思路和题解一模一样,为什么就是不通过?那你一定是忘记了加import!!!在给出的程序的第一行加入import java.util.*;万事大吉!
2020-05-15 22:53:58
1489
原创 python 数组与常数相乘 a = [0]*x 格式含义
参考 https://blog.youkuaiyun.com/qq_40549751/article/details/80727884```pythonimport sysa = "12352523452334"num = len(a)k = int(num/3)print(k)#[0]是一个str类型,K个str组成sub数组,list类型sub = [0]*kfor i in ran...
2020-04-27 18:31:27
4454
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人