自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

白露甘三的博客

白露甘三的学习记录,欢迎围观,白鹭甘三也是我

  • 博客(45)
  • 收藏
  • 关注

原创 实验四: IPv6路由选择协议配置

一、实验目的掌握IPv6路由选择协议的原理及配置方法,包括RIPng和OSPFv3。二、实验内容1、RIPng的配置;2、OSPFv3的配置。三 、实验步骤1 RIPng 的配置1.1 将设备添加到拓扑区并连接1.2 配置路由器的 ipv6 RIPng 相关配置配置命令如下:1. conf t // 进入全局配置模式2. pv6 uni // 打开 ipv6 配置3. ipv6 router rip 1 // 在 ...

2022-04-17 14:47:59 1828

原创 实验三: IPv6动态地址分配

实验三: IPv6动态地址分配一、实验目的掌握IPv6动态地址分配原理及方法。二、实验内容1、SLAAC;2、SLAAC+无状态DHCPv6;3、有状态DHCPv6。三 、实验步骤1 SLAAC1.1 添加设备到拓扑区1.2 查看配置前 PC1 的 ipv6 配置1.3 进入 R1 配置 SLAACconf t // 进入全局配置模式ipv6 uni // 开启 ipv6 配置int f0/0 // 进去 f0/0 接口ipv6 en /

2022-04-02 15:28:33 3662 1

原创 150. 逆波兰表达式求值

LeetCode链接栈class Solution { public int evalRPN(String[] tokens) { Deque<String> stack = new LinkedList<>(); for(String s : tokens){ if("+".equals(s)){ int a = Integer.parseInt(stack.pop());

2022-03-28 23:56:42 434

原创 1047. 删除字符串中的所有相邻重复项

LeetCode链接栈class Solution { public String removeDuplicates(String s) { Deque<Character> que = new LinkedList<>(); for(Character c: s.toCharArray()){ if(que.isEmpty() || que.peek() != c){ que.pu

2022-03-28 00:16:19 194

原创 20. 有效的括号

LeetCode链接在这里插入代码片时间复杂度:空间复杂度:

2022-03-27 00:33:59 301

原创 225. 用队列实现栈

LeetCode链接方法一class MyStack { private Deque<Integer> a; private Deque<Integer> b; public MyStack() { a = new ArrayDeque<>(); b = new ArrayDeque<>(); } public void push(int x) { a.ad

2022-03-26 23:38:48 211

原创 232. 用栈实现队列

LeetCode链接方法一class MyQueue { private Deque<Integer> a; private Deque<Integer> b; public MyQueue() { a = new ArrayDeque<>(); b = new ArrayDeque<>(); } public void push(int x) { a.pu

2022-03-26 22:53:37 192

原创 基于 Servlet 的 smbms(含静态资源及源码)

1 环境简介环境:JDK 1.8apache-tomcat-9.0.59apache-maven-3.8.4IntelliJ IDEA 2021.1.2 x642 初始配置2.1 web.xml 初始配置<?xml version="1.0" encoding="UTF-8"?><web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/X

2022-03-26 15:58:29 889

原创 459. 重复的子字符串

LeetCode链接在这里插入代码片时间复杂度:空间复杂度:

2022-03-19 23:24:37 138

原创 55. 跳跃游戏

LeetCode链接贪心算法class Solution { public boolean canJump(int[] nums) { if(nums.length == 1) return true; // 取数组第一个元素为初始范围, 即初始化可以跳到的最远下标 int cover = nums[0]; int i = 1; while(i <= cover){ if(cover+1

2022-03-17 20:50:15 2900

原创 53. 最大子数组和

LeetCode链接暴力class Solution { public int maxSubArray(int[] nums) { int max = nums[0]; for(int i = 0; i < nums.length; i++){ int count = 0; for(int j = i; j < nums.length; j++){ count += num

2022-03-17 16:58:15 612

原创 376. 摆动序列

LeetCode链接贪心算法class Solution { public int wiggleMaxLength(int[] nums) { if(nums.length == 1) return 1; int curr = 0; int prev = 0; // 最开始的峰值 int count = 1; for(int i = 0; i < nums.length-1; i++){

2022-03-17 15:26:00 897

原创 455. 分发饼干

LeetCode链接贪心算法class Solution { public int findContentChildren(int[] g, int[] s) { // 对两个数组进行排序 Arrays.sort(g); Arrays.sort(s); int count = 0; int i = g.length-1; int j = s.length-1; // 遍历 g,即孩子胃口数组

2022-03-17 00:20:39 1087

原创 28. 实现 strStr()

LeetCode链接暴力class Solution { public int strStr(String haystack, String needle) { int m = haystack.length(); int n = needle.length(); // 遍历 haystack 字符串 for(int i = 0; i<= m-n; i++){ int index = i;

2022-03-16 13:17:01 331

原创 349. 两个数组的交集

LeetCode链接集合法class Solution { public int[] intersection(int[] nums1, int[] nums2) { Set<Integer> s1 = new HashSet<>(); Set<Integer> s2 = new HashSet<>(); for(int i: nums1){ // 存入 nums1 中所有不重复的元素

2022-03-16 00:02:51 332

原创 剑指 Offer 58 - II. 左旋转字符串

LeetCode链接方法一class Solution { public String reverseLeftWords(String s, int n) { int len = s.length(); char[] chars = s.toCharArray(); // 整个字符串数组反转 reverse(chars, 0, len-1); // 以 k 为界分别反转两个字符串 reverse(c

2022-03-15 17:19:08 322

原创 151. 颠倒字符串中的单词

LeetCode链接API 法class Solution { public String reverseWords(String s) { // 去除首尾的空格 s = s.trim(); // 以空格为分隔获取字符串集合 List<String> arr = Arrays.asList(s.split("\\s+")); Collections.reverse(arr); return

2022-03-15 16:29:07 169

原创 541. 反转字符串 II

LeetCode链接方法一class Solution { public String reverseStr(String s, int k) { char[] chars = s.toCharArray(); for(int i = 0; i< chars.length; i += 2*k){ int start = i; int end = Math.min(i+k, chars.length)-1;

2022-03-15 13:08:28 114

原创 剑指 Offer 05. 替换空格

LeetCode链接方法一class Solution { public String replaceSpace(String s) { StringBuilder sb = new StringBuilder(s); for(int i = 0; i< sb.length(); i++){ if(' ' == sb.charAt(i)){ sb.replace(i, i+1, "%20");

2022-03-15 00:04:07 121

原创 344. 反转字符串

LeetCode双指针class Solution { public void reverseString(char[] s) { // 特殊判断 if(s == null || s.length == 1) return; int j = s.length-1; for(int i = 0; i< s.length/2; i++){ char temp = s[i]; s[i] =

2022-03-14 21:59:20 377

原创 18. 四数之和

LeetCode链接排序 + 双指针class Solution { public List<List<Integer>> fourSum(int[] nums, int target) { List<List<Integer>> res = new ArrayList<>(); if(nums == null || nums.length <4) return res; Array

2022-03-14 21:41:13 92

原创 15. 三数之和

LeetCode链接排序 + 双指针class Solution { public List<List<Integer>> threeSum(int[] nums) { List<List<Integer>> res = new ArrayList<>(); // 特殊判断,长度小于 3 的数组不可能有结果 if(nums == null || nums.length <3) ret

2022-03-14 19:38:21 544

原创 383. 赎金信

LeetCode链接字母表class Solution { public boolean canConstruct(String ransomNote, String magazine) { int[] alphbet = new int[26]; // 遍历 ransomNote 字符串 for(int i = 0; i< ransomNote.length(); i++){ char c = ransomNote.

2022-03-13 23:34:21 89

原创 454. 四数相加 II

LeetCode链接这题不能用暴力法,会超时哈希表class Solution { public int fourSumCount(int[] nums1, int[] nums2, int[] nums3, int[] nums4) { HashMap<Integer, Integer> map = new HashMap<>(); int count = 0; for(int i = 0; i< nums1.le

2022-03-13 21:41:40 330

原创 202. 快乐数

LeetCode链接哈希表class Solution { public boolean isHappy(int n) { Set<Integer> set = new HashSet<>(); while(true){ int count = 0; // 计算整数每个位置上数字的平方和 while(n > 0){ int pow

2022-03-13 20:38:07 314

原创 实验二: 子网划分及静态地址配置

实验二: 子网划分及静态地址配置一、实验目的划分子网,手动配置静态地址及路由。二、实验内容完成下图的地址规划实验,配置IPv6地址及相应的路由协议,并调试通过。并Wireshark抓包分析IPv6头部。三 、实验步骤1 在拓扑区添加需要的设备直接拖动左侧的设备到拓扑区即可2 连接所有设备3 配置静态地址及路由使用Secure CRT 仿真界面配置 PC 静态地址以及路由3.1 配置路由器接口R1 f0/0 接口配置命令如下:进入全局配置模式:config terminal

2022-03-13 13:11:07 3391 2

原创 1. 两数之和

LeetCode链接暴力法class Solution { public int[] twoSum(int[] nums, int target) { int curr, trav; int[] res = new int[2]; for(int i = 0; i< nums.length - 1; i++){ for(int j = i + 1; j< nums.length; j++){

2022-03-12 01:06:16 300

原创 Servlet 设置了字符集还是乱码解决方法

后端设置代码如下 resp.setCharacterEncoding("utf-8");设置编码的代码只有这一行修改为: resp.setCharacterEncoding("utf-8"); resp.setContentType("text/html;charset=utf-8");乱码问题解决但是没有第一行代码也是没有乱码的 resp.setContentType("text/html;charset=utf-8");.

2022-03-10 15:53:31 686

原创 707. 设计链表

嗯写法class ListNode{ int val; ListNode next; ListNode(){} ListNode(int val){this.val = val;}}class MyLinkedList { private ListNode head; private int size; public MyLinkedList() { head = null; size = 0; }

2022-03-10 10:48:07 228

原创 java.util.ConcurrentModificationException

报错如下Exception in thread "main" java.util.ConcurrentModificationException at java.base/java.util.HashMap$HashIterator.nextNode(HashMap.java:1494) at java.base/java.util.HashMap$KeyIterator.next(HashMap.java:1517)出错部分代码如下 for(int i: s1){

2022-03-10 00:23:17 656

原创 242. 有效的字母异位词

LeetCode链接HashMap法class Solution { public boolean isAnagram(String s, String t) { if(s.length() != t.length()) return false; HashMap<Character, Integer> map = new HashMap<>(); for(int i = 0; i< s.length(); i++){

2022-03-09 23:46:06 284

原创 142. 环形链表 II

LeetCode双指针法public class Solution { public ListNode detectCycle(ListNode head) { ListNode slow = head; ListNode fast = head; while(fast != null && fast.next != null){ slow = slow.next; fast = fa

2022-03-09 20:15:50 360

原创 07. 链表相交

LeetCode暴力法public class Solution { public ListNode getIntersectionNode(ListNode headA, ListNode headB) { ListNode nodeA = headA; while(nodeA != null){ ListNode nodeB = headB; while(nodeB != null){

2022-03-09 18:52:41 147

原创 19. 删除链表的倒数第 N 个结点

leetCode链接虚拟头结点迭代class Solution { public ListNode removeNthFromEnd(ListNode head, int n) { // 虚拟头节点 ListNode virt = new ListNode(0, head); // 快指针 ListNode fast = virt; // 慢指针 ListNode slow = virt;

2022-03-09 17:47:36 211

原创 24. 两两交换链表中的节点

leetCode链接迭代class Solution { public ListNode swapPairs(ListNode head) { // 前置节点 ListNode prev = null; // 交换左节点 ListNode curr = head; // 前一个条件作用于 head 为空和节点数为偶数,后一个条件作用于节点数为奇数 while(curr != null &&am

2022-03-08 00:17:59 633

原创 206. 反转链表

LeetCode链接三指针法class Solution { public ListNode reverseList(ListNode head) { if(head == null || head.next == null) return head; // 中间节点 ListNode node = head; // 后置节点 ListNode next = head.next; while(next

2022-03-07 00:10:34 424

原创 203. 移除链表元素

虚拟头结点法/** * 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-03-04 22:10:57 236

原创 Java Integer 中的常量池/缓存技术

IntegerCache 源码如下 /** * Cache to support the object identity semantics of autoboxing for values between * -128 and 127 (inclusive) as required by JLS. * * The cache is initialized on first usage. The size of the cache * may b

2022-03-04 16:04:12 299

原创 59. 螺旋矩阵 II

leetCode链接模拟法class Solution { public int[][] generateMatrix(int n) { // 定义一个 n*n 的空矩阵 int[][] matrix = new int[n][n]; // 定义左上右下边界 int left = 0; int top = 0; int right = n - 1; int bottom = n -

2022-03-02 11:04:05 126

原创 JVM、JRE 和 JDK 简叙

JVMJVM 全称是 Java Virual Machine(Java 虚拟机)用于运行 Java 字节码文件,实现 Java 程序在不同平台如 windows、linux 等可以运行出相同的结果即实现了 Java 的跨平台特性,或者说 Java 的平台无关性JREJRE 全称 Java Run Enviroment(Java 运行时环境)如果想要运行已编译的 Java 程序,首先要安装 JRE。JRE 中包含 JVM,Java 类库,java 命令和其他的一些基础构件J

2022-03-01 15:55:55 263

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除