05 2020 档案
摘要:class Solution { public int[] maxSlidingWindow(int[] nums, int k) { //双指针滑窗 int l = nums.length; if( l == 0)return nums; int[] res = new int[l - k + 1
阅读全文
摘要:class Solution { public List<Integer> topKFrequent(int[] nums, int k) { //先统计每个数字出现的频率 Map<Integer,Integer> map = new HashMap<>(); for(int i = 0; i <
阅读全文
摘要:拓扑排序 class Solution { public int[] findOrder(int numCourses, int[][] prerequisites) { //统计所有节点的入度 int[] res = new int[numCourses]; int[] in = new int[
阅读全文
摘要:public int[][] merge(int[][] arr) { //根据第一个元素排序,快速排序 if(arr.length == 0) return new int[0][0]; if(arr.length == 1) return arr; boolean[] isvristed = n
阅读全文
摘要:class Solution { int result; public int sumNumbers(TreeNode root) { if(root == null)return 0; sumNumber(root, 0); return result; } public void sumNumb
阅读全文
摘要:总是忘记,记录一下。==对于基本类型和引用类型==作用的效果不同1:对于基本类型比较的是值2:对于引用类型比较的是引用地址 String a = "hello"; String b = "hello"; String c = new String("hello"); System.out.print
阅读全文
摘要:import java.util.*; public class Solution { public boolean wordBreak(String s, Set<String> dict) { boolean[] dp = new boolean[s.length()+1]; dp[0] = t
阅读全文
摘要:后端项目完整代码:https://github.com/shenweiquan/jwt-demo 一:准备工作 1-1 运行环境: 后端:jdk1.8,springboot,jwt 前端:vue , elementui 1-2 创建前端和后端项目 后端项目结构: 二:重要的代码 JwtUtil pa
阅读全文
摘要:原题: class Solution { //构建前缀树 + dfs 深度遍历字符数组,然后和前缀树比较 //定义节点 static class TireNode{ //使用map 还是 数组 Map<Character,TireNode> childNode; boolean isEnd = fa
阅读全文
摘要:1 class WordDictionary { 2 //使用什么来存储单词 >字典树?? 3 4 //字典树 5 // 1 新建节点 6 static class TireNode{ 7 boolean flag ; //记录该单词是否出现 8 Map<Character, TireNode> c
阅读全文
摘要:一:静态代理 在使用静态代理时,需要定义接口或者父类。被代理对象(目标对象)和代理对象都需要实现同一接口或者继承父类。 使用步骤: 1:定义一个接口IStudentDao 2:被代理对象(目标对象)StudentDao实现接口 3:代理对象StudentDaoProxy也需要实现接口 4:代理对象调
阅读全文