上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 35 下一页
摘要: IoC则可以解决这种问题,它可以帮我们维护对象与对象之间的依赖关系,并且降低对象之间的耦合度 IoC容器,它的本质就是一个工厂 参考:牛客 阅读全文
posted @ 2022-11-12 13:22 northli 阅读(51) 评论(0) 推荐(0) 编辑
摘要: IO多路复用指的是单个进程或者线程能同时处理多个IO请求,select,epoll,poll是LinuxAPI提供的复用方式。本质上由操作系统内核缓冲IO数据,使得单个进程线程能监视多个文件描述符。select是将装有文件描述符的集合从用户空间拷贝到内核空间,底层是数组,poll和select差距不 阅读全文
posted @ 2022-11-12 13:17 northli 阅读(32) 评论(0) 推荐(0) 编辑
摘要: import java.util.*; public class Solution { public ArrayList<ArrayList<Integer>> threeSum(int[] num) { //num排序 //复制三个数组a,b,c //遍历a,遍历b,查找c中是否有0-a-b // 阅读全文
posted @ 2022-11-12 12:52 northli 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 一、数组的复制 int[] re = Arrays.copyOf(nums, len) 一、数组的排序,不用返回值接收,默认升序 Arrays.sort(nums) 二、数组查找 参考:https://blog.csdn.net/weixin_38626799/article/details/105 阅读全文
posted @ 2022-11-12 12:51 northli 阅读(21) 评论(0) 推荐(0) 编辑
摘要: import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param nums int整型一维数组 * @return int整型 */ public int minNu 阅读全文
posted @ 2022-11-12 11:03 northli 阅读(12) 评论(0) 推荐(0) 编辑
摘要: 从小到大:Arrays.sort(arr) 从大到小: 参考: https://blog.csdn.net/Lbility/article/details/126624358 阅读全文
posted @ 2022-11-12 10:44 northli 阅读(34) 评论(0) 推荐(0) 编辑
摘要: import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param array int整型一维数组 * @return int整型一维数组 */ public int[ 阅读全文
posted @ 2022-11-12 10:11 northli 阅读(10) 评论(0) 推荐(0) 编辑
摘要: import java.util.*; public class Solution { public int MoreThanHalfNum_Solution(int [] array) { //遍历数组,值标记位key //新建一个map,map包含这个key,那么对应的value+1,map不包 阅读全文
posted @ 2022-11-11 21:49 northli 阅读(10) 评论(0) 推荐(0) 编辑
摘要: 一、判断一个值是否在map中 Map<Integer,Integer> map = new HashMap<Integer,Integer>(); b=33; if(map.containsKey(b)){ //b在map中,也就是说map的keys中存在b }else{ } 二、遍历map中的ke 阅读全文
posted @ 2022-11-11 17:44 northli 阅读(282) 评论(0) 推荐(0) 编辑
摘要: import java.util.*; public class Solution { /** * * @param numbers int整型一维数组 * @param target int整型 * @return int整型一维数组 */ public int[] twoSum (int[] n 阅读全文
posted @ 2022-11-11 17:40 northli 阅读(8) 评论(0) 推荐(0) 编辑
上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 35 下一页