上一页 1 2 3 4 5 6 7 8 9 10 ··· 17 下一页
摘要: JDK动态代理 例子: import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; /** * @author Pickle * @versi 阅读全文
posted @ 2024-02-16 20:40 破忒头头 阅读(22) 评论(0) 推荐(0)
摘要: 1、利用MyMateObjectHandler继承MataObjectHandler重写insertFill和updateFill方法,使用自定义的规则对相应的字段进行填充 package cn.pickle.reggle.common; import com.baomidou.mybatisplu 阅读全文
posted @ 2024-02-12 14:54 破忒头头 阅读(119) 评论(0) 推荐(0)
摘要: 自定义对象映射器并扩展MVC框架的消息转换器,解决了后端Long类型传到前端精度丢失问题 利用Jcson实现对象的序列化和反序列化规则 /** * 对象映射器:基于jackson将Java对象转为json,或者将json转为Java对象 * 将JSON解析为Java对象的过程称为 [从JSON反序列 阅读全文
posted @ 2024-02-12 14:42 破忒头头 阅读(103) 评论(0) 推荐(0)
摘要: 分别计算左右边界 o(N) o(N) class Solution { public int trap(int[] height) { /* 分别考虑每一个高度为底的情况,当前高度所能盛水量等于左侧边界和右侧边界高度中最小值减去当前元素高度 */ int size = height.length; 阅读全文
posted @ 2024-02-12 14:32 破忒头头 阅读(11) 评论(0) 推荐(0)
摘要: 1.问题拆分成两个简单的实现 O(N) O(N) 将「相邻的孩子中,评分高的孩子必须获得更多的糖果」这句话拆分为两个规则,分别处理。 左规则:当 ratings[i−1]<ratings[i] 时,i 号学生的糖果数量将比 i−1 号孩子的糖果数量多。 右规则:当 ratings[i]>rating 阅读全文
posted @ 2024-02-08 17:49 破忒头头 阅读(17) 评论(0) 推荐(0)
摘要: 1.暴力解法 O(n^2) class Solution { public int canCompleteCircuit(int[] gas, int[] cost) { int length = gas.length; //把当前i节点作为起始节点 for(int i = 0; i < lengt 阅读全文
posted @ 2024-02-08 17:34 破忒头头 阅读(14) 评论(0) 推荐(0)
摘要: 就用除法 class Solution { public int[] productExceptSelf(int[] nums) { int[] answer = new int[nums.length]; int sum = 1; int zeroNum = 0; for (int i = 0; 阅读全文
posted @ 2024-02-07 16:01 破忒头头 阅读(11) 评论(0) 推荐(0)
摘要: 先来个大的 class RandomizedSet { private HashSet<Integer> hashSet; public RandomizedSet() { hashSet = new HashSet<Integer>(); } public boolean insert(int v 阅读全文
posted @ 2024-02-07 14:40 破忒头头 阅读(11) 评论(0) 推荐(0)
摘要: 排序,i代表至少发表的论文数量 时间复杂度:O(nlogn) 空间复杂度:O(logn) class Solution { public int hIndex(int[] citations) { // 0 1 3 5 6 int length = citations.length; Arrays. 阅读全文
posted @ 2024-02-07 11:14 破忒头头 阅读(23) 评论(0) 推荐(0)
摘要: class Solution { public int jump(int[] nums) { if (nums.length <= 1) return 0; //记录每次起跳所能跳到的最远的距离 int farestIndex = 0; int maxIndex = 0; int start = 0 阅读全文
posted @ 2024-02-05 17:45 破忒头头 阅读(19) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 9 10 ··· 17 下一页