- 博客(11)
- 收藏
- 关注
原创 调整数组顺序使奇数位于偶数前面
class Solution { int[] numss; public int[] exchange(int[] nums) { numss = nums; solution(0,nums.length - 1); return numss; } void solution(int l,int r){ if(l >= r) return; int i = l - 1 , j = r +.
2022-01-23 00:29:50
92
原创 剪绳子 Java
结论当整数中拆分成3和2时(2的数量不大于2个)积最大证明(参考y总):前提:假设结果为a1 - anai < 5反证法:若ai >=5,则ai = (ai - 3)*3 = 3ai - 9 > ai等价于 ai > 4.5ai > ai所以 ai <5ai 可以不为44 = 2 * 22的数量不大于22 + 2 + 2 = 62 * 2 * 2 = 8 < 3 * 3结论成立class Solution { public.
2022-01-18 23:32:32
215
原创 反转链表 Java
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode() {} * ListNode(int val) { this.val = val; } * ListNode(int val, ListNode next) { this.val = val; this.next = next; } * }.
2022-01-17 13:48:14
164
原创 勿重复字符的最长字串
class Solution { public int lengthOfLongestSubstring(String s) { int start = 0; int[][] map = new int[128][1]; int ans = 0; for(int i = 0;i < s.length(); i++){ map[s.charAt(i)][0]++; while(map.
2022-01-17 13:37:52
140
原创 矩阵中的路径
dfs暴力class Solution { String w; char[][] b; public boolean exist(char[][] board, String word) { w = word; b = board; for(int i = 0;i < board.length; i++){ for(int j = 0;j < board[0].length; j++){ .
2022-01-14 22:07:58
238
原创 旋转数组的最小数字
整数二分class Solution { public int minArray(int[] numbers) { int l = 0; int r = numbers.length - 1; while(r > 0 && numbers[r] == numbers[l]) r--; if(numbers[r] >= numbers[l]) return numbers[l]; while.
2022-01-14 20:58:25
177
原创 配置ssh公钥登录
生成公私钥生成当前用户的公私钥ssh-keygen -t rsaGenerating public/private rsa key pair.Enter file in which to save the key (/root/.ssh/id_rsa): (回车)Enter passphrase (empty for no passphrase):(回车)Enter same passphrase again: (回车)Your identification has been saved in
2021-12-16 14:24:51
2154
原创 CentOS上Docker安装和换源
docker安装# 使用命令一键安装curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyundocker-compose安装下载二进制包# 最新版本发布地址https://github.com/docker/compose/releases# 运行以下命令以下载 Docker Compose 的1.29.2版本,此url可在自行替换为最新发布地址中需要的版本sudo curl -L "https://github
2021-12-16 14:21:05
1934
原创 Centos 系统安装 dracut-initqueue timeout 异常
Centos 系统安装 dracut-initqueue timeout 异常在windows上使用软碟通烧制u盘 此处的LABEL信息就是ISO的LABEL信息,在2步可以修改,如果在2步把LABEL的信息修改了小于11位的长度,则后面的步骤就不用看了,可直接从U盘安装;Windows系统限制了LABEL的长度为11,多出的部分被截断了,所以导致U盘的LABEL只有“CentOS 7 x8”11位。由于盘符的变化导致dracut-initqueue timeout异常无法正常安装。网上搜索常见的解
2021-12-09 13:45:24
1239
原创 设置主机名和ip映射
设置主机名和ip映射设置主机名# 查看主机名hostname# 删除文件内容该为要设置的主机名Mastervim /etc/hostnameip映射# 打开hosts文件在低端加入ip 主机名 格式,etc: 192.168.242.130 Master vim /etc/hosts# 重启网路服务systemctl restart network...
2021-06-18 00:14:30
447
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人