
Java
JAVA
Starzkg
你已经是一个成熟的程序猿了,要学会自己DEBUG了。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Spring Cloud——基于Dubbo的分布式Session解决方案
环境配置spring boot 2.6.3spring cloud 2021.0.1spring cloud alibaba 2021.0.1.0nacos server 2.0.4dubbo 2.7.15解决方案源代码:https://gitee.com/myzstu/authpackage club.zstuca.myzstu.auth.service.impl;import club.zstuca.myzstu.session.service.ISessionService;原创 2022-03-20 12:04:19 · 997 阅读 · 0 评论 -
Dubbo——Dubbo协议整合Jackson序列化解决方案
环境配置spring boot 2.6.3spring cloud 2021.0.1spring cloud alibaba 2021.0.1.0nacos server 2.0.4dubbo 2.7.15官方文档序列化扩展:SPI扩展实现-序列化扩展多协议配置:配置多协议已知扩展解决方案源代码:https://gitee.com/myzstu/auth/tree/master/auth-core/src/main/java/club/zstuca/myzstu/dubbo/se原创 2022-03-20 11:05:59 · 3577 阅读 · 0 评论 -
Element UI + Java Web—— Failed to decode downloaded font:xxx.woff
问题描述解决方案方法一 <build> <resources> <resource> <directory>${project.basedir}/build/</directory> <excludes> <exclude>**/*.woff</exclude>原创 2022-03-17 11:43:30 · 1044 阅读 · 0 评论 -
Dubbo Admin —— Spring Cloud Alibaba 2021.1 + Nacos + Dubbo Admin参考配置
环境配置 <dependencyManagement> <dependencies> <!--Spring Boot--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dep原创 2022-01-11 00:06:33 · 891 阅读 · 0 评论 -
JDK——NIO系统调用浅析
JDK里,Java标准库和部分工具的源码中,BSD和Linux的平台相关源码都是在solaris目录里的。 原本SunJDK的源码里平台相关的目录就是从solaris和windows这两个目录开始的,后来Unix系列的平台相关代码全都放在solaris目录下了,共用大部分代码。JDK底层代码native 方法openjdk\jdk\src\solaris\native\sun\nio\ch\EPoll.copenjdk\jdk\src\solaris\classes\sun\nio\ch.原创 2022-01-10 21:38:56 · 986 阅读 · 0 评论 -
Spring Cloud Gateway——2020.x以上版本HTTP 503 或 NoLoadBalancer[负载均衡]解决方案
`spring-cloud-starter-gateway`不再依赖默认的`LoadBalancer`,需要引入`spring-cloud-starter-loadbalancer`,并且无法解析http服务名称,例如:http://servicename,也无法访问。原创 2022-01-08 22:07:39 · 1076 阅读 · 0 评论 -
阿里巴巴2021秋招笔试题20211119
源代码:https://gitee.com/shentuzhigang/algorithm/tree/master/exam-alibaba/exam-alibaba-20211119第一题题目大意:有长度为n的数组a有k次机会在连续长度不超过m的区间每个元素+1使得数组全部元素变成偶数import java.util.LinkedList;import java.util.Scanner;/** * @author ShenTuZhiGang * @version 1.0.0 * @原创 2021-11-19 21:32:20 · 682 阅读 · 0 评论 -
LeetCode 36 有效的数独
https://leetcode-cn.com/problems/valid-sudoku/解决方案class Solution { public boolean isValidSudoku(char[][] board) { List<Set<Character>> list = new ArrayList<>(); for (int i = 0; i < 27; i++) { list.add(原创 2021-11-19 19:19:56 · 440 阅读 · 0 评论 -
LeetCode 35 搜索插入位置
https://leetcode-cn.com/problems/search-insert-position/解决方案class Solution { public int searchInsert(int[] nums, int target) { int left = 0; int right = nums.length - 1; while (left <= right) { int mid = (left +原创 2021-11-19 19:18:45 · 486 阅读 · 0 评论 -
LeetCode 34 在排序数组中查找元素的第一个和最后一个位置
https://leetcode-cn.com/problems/find-first-and-last-position-of-element-in-sorted-array/解决方案class Solution { public int[] searchRange(int[] nums, int target) { int leftIdx = binarySearch(nums, target, 0, true); return new int[]{leftI原创 2021-11-19 19:16:57 · 212 阅读 · 0 评论 -
LeetCode 33 搜索旋转排序数组
https://leetcode-cn.com/problems/search-in-rotated-sorted-array/解决方案class Solution { public int search(int[] nums, int target) { int n = nums.length; if (n == 0) { return -1; } if (n == 1) { ret原创 2021-11-19 19:15:52 · 190 阅读 · 0 评论 -
LeetCode 32 最长有效括号
https://leetcode-cn.com/problems/longest-valid-parentheses/解决方案class Solution { public int longestValidParentheses(String s) { int maxans = 0; LinkedList<Integer> stack = new LinkedList<>(); stack.push(-1);原创 2021-11-19 19:14:49 · 276 阅读 · 0 评论 -
LeetCode 31 下一个排列
https://leetcode-cn.com/problems/next-permutation/解决方案class Solution { public void nextPermutation(int[] nums) { int i = nums.length - 2; for (; i >= 0 && nums[i] >= nums[i + 1]; --i) ; if (i >= 0) {原创 2021-11-19 19:13:54 · 201 阅读 · 0 评论 -
LeetCode 30 串联所有单词的子串
https://leetcode-cn.com/problems/substring-with-concatenation-of-all-words/解决方案class Solution { public List<Integer> findSubstring(String s, String[] words) { List<Integer> res = new ArrayList<>(); if (s == null || s原创 2021-11-18 21:05:03 · 198 阅读 · 0 评论 -
LeetCode 29 两数相除
https://leetcode-cn.com/problems/divide-two-integers/submissions/解决方案class Solution { public int divide(int dividend, int divisor) {// 考虑被除数为最小值的情况 if (dividend == Integer.MIN_VALUE) { if (divisor == 1) { return I原创 2021-11-18 21:03:25 · 166 阅读 · 0 评论 -
LeetCode 28 实现 strStr()
https://leetcode-cn.com/problems/implement-strstr/解决方案class Solution { public int strStr(String haystack, String needle) { if (needle.length() == 0) { return 0; } for (int i = 0; i + needle.length() <= haystack.原创 2021-11-17 21:12:20 · 332 阅读 · 0 评论 -
LeetCode 27 移除元素
https://leetcode-cn.com/problems/remove-element/解决方案class Solution { public int removeElement(int[] nums, int val) { int len = 0; for (int i = 0; i < nums.length; ++i) { if (val != nums[i]) { nums[len++]原创 2021-11-17 21:11:18 · 294 阅读 · 0 评论 -
LeetCode 26 删除有序数组中的重复项
https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array/解决方案class Solution { public int removeDuplicates(int[] nums) { int len = 0; for (int i = 1; i < nums.length; ++i) { if (nums[i - 1] != nums[i]) {原创 2021-11-17 21:10:12 · 302 阅读 · 0 评论 -
LeetCode 25 K个一组翻转链表
https://leetcode-cn.com/problems/reverse-nodes-in-k-group/解决方案class Solution { public ListNode reverseKGroup(ListNode head, int k) { return reverseKGroup(head, head, k, 1); } public ListNode reverseKGroup(ListNode head, ListNode tail原创 2021-11-17 21:09:21 · 409 阅读 · 0 评论 -
LeetCode 24 两两交换链表中的节点
https://leetcode-cn.com/problems/swap-nodes-in-pairs/、解决方案class Solution { public ListNode swapPairs(ListNode head) { if (head != null && head.next != null) { ListNode node = head.next; head.next = swapPairs(he原创 2021-11-16 20:34:49 · 517 阅读 · 0 评论 -
LeetCode 23 合并K个升序链表
https://leetcode-cn.com/problems/merge-k-sorted-lists/解决方案import java.util.Comparator;import java.util.PriorityQueue;class Solution { public ListNode mergeKLists(ListNode[] lists) { if (lists.length == 0) { return null;原创 2021-11-16 20:33:51 · 477 阅读 · 0 评论 -
LeetCode 22 括号生成
https://leetcode-cn.com/problems/generate-parentheses/解决方案class Solution { List<String> ans = new ArrayList<>(); public List<String> generateParenthesis(int n) { dfs("", 0, n); return ans; } public void原创 2021-11-12 21:20:21 · 336 阅读 · 0 评论 -
LeetCode 21 合并两个有序链表
https://leetcode-cn.com/problems/merge-two-sorted-lists/解决方案class Solution { public ListNode mergeTwoLists(ListNode l1, ListNode l2) { ListNode head = new ListNode(); ListNode pos = head; while (l1 != null && l2 != nul原创 2021-11-12 21:19:04 · 574 阅读 · 0 评论 -
LeetCode 20 有效的括号
https://leetcode-cn.com/problems/valid-parentheses/解决方案class Solution { public boolean isValid(String s) { Stack<Integer> stack = new Stack<>(); stack.ensureCapacity(s.length()); for (int i = 0; i < s.length();原创 2021-11-12 21:17:24 · 280 阅读 · 0 评论 -
LeetCode 19 删除链表的倒数第 N 个结点
https://leetcode-cn.com/problems/remove-nth-node-from-end-of-list/解决方案class Solution { public ListNode removeNthFromEnd(ListNode head, int n) { int i = removeNthFromEnd0(head, n); if (i == n) { return head.next; }原创 2021-11-12 21:15:57 · 276 阅读 · 0 评论 -
LeetCode 18 四数之和
https://leetcode-cn.com/problems/4sum/解决方案class Solution { public List<List<Integer>> fourSum(int[] nums, int target) { int n = nums.length; Arrays.sort(nums); List<List<Integer>> ans = new ArrayList<原创 2021-11-12 21:14:49 · 167 阅读 · 0 评论 -
LeetCode 17 电话号码的字母组合
https://leetcode-cn.com/problems/letter-combinations-of-a-phone-number/解决方案class Solution { public List<String> letterCombinations(String digits) { List<String> combinations = new ArrayList<>(); if (digits.length() =原创 2021-11-12 21:13:42 · 125 阅读 · 0 评论 -
LeetCode 16 最接近的三数之和
https://leetcode-cn.com/problems/3sum-closest/解决方案class Solution { public int threeSumClosest(int[] nums, int target) { int n = nums.length; Arrays.sort(nums); int abs = Integer.MAX_VALUE; int ans = 0; for (int原创 2021-11-12 21:11:40 · 126 阅读 · 0 评论 -
LeetCode 15 三数之和
https://leetcode-cn.com/problems/3sum/解决方案class Solution { public String longestCommonPrefix(String[] strs) { if (strs == null && strs.length == 0) { return ""; } int minLength = Integer.MAX_VALUE;原创 2021-11-12 21:10:20 · 300 阅读 · 0 评论 -
LeetCode 14 最长公共前缀
https://leetcode-cn.com/problems/longest-common-prefix/解决方案class Solution { public String longestCommonPrefix(String[] strs) { if (strs == null && strs.length == 0) { return ""; } int minLength = Integer.MA原创 2021-11-12 21:04:53 · 132 阅读 · 0 评论 -
LeetCode 13 罗马数字转整数
https://leetcode-cn.com/problems/roman-to-integer/解决方案class Solution { int[] values = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1}; String[] symbols = {"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"}; public原创 2021-11-12 21:03:32 · 296 阅读 · 0 评论 -
LeetCode 12 整数转罗马数字
https://leetcode-cn.com/problems/integer-to-roman/解决方案class Solution { int[] values = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1}; String[] symbols = {"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"}; public原创 2021-11-10 20:43:15 · 252 阅读 · 0 评论 -
LeetCode 11 盛最多水的容器
https://leetcode-cn.com/problems/container-with-most-water/解决方案class Solution { public int maxArea(int[] height) { int l = 0, r = height.length - 1; int ans = 0; while (l < r) { ans = Math.max(ans, (r - l) * Mat原创 2021-11-10 20:41:54 · 678 阅读 · 0 评论 -
LeetCode 10 正则表达式匹配
https://leetcode-cn.com/problems/regular-expression-matching/解决方案class Solution { public boolean isMatch(String s, String p) { int m = s.length(); int n = p.length(); boolean[][] dp = new boolean[m + 1][n + 1]; dp[0][0原创 2021-11-10 20:40:20 · 130 阅读 · 0 评论 -
LeetCode 9 回文数
https://leetcode-cn.com/problems/palindrome-number/解决方案class Solution { public boolean isPalindrome(int x) { String s = String.valueOf(x); for (int i = 0; i < s.length() / 2; i++) { if (s.charAt(i) != s.charAt(s.length(原创 2021-11-10 20:38:35 · 248 阅读 · 0 评论 -
LeetCode 8 字符串转换整数 (atoi)
https://leetcode-cn.com/problems/string-to-integer-atoi/解决方案class Solution { public int myAtoi(String s) { s = s.trim(); long num = 0; for (int i = (s.startsWith("-") || s.startsWith("+")) ? 1 : 0; i < s.length原创 2021-11-10 20:35:57 · 275 阅读 · 0 评论 -
LeetCode 6 Z 字形变换
https://leetcode-cn.com/problems/zigzag-conversion/解决方案class Solution { public String convert(String s, int numRows) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < numRows; i++) { boolean flag = i != numRow原创 2021-11-10 20:31:18 · 113 阅读 · 0 评论 -
LeetCode 5 最长回文子串
https://leetcode-cn.com/problems/longest-palindromic-substring/解决方案class Solution { public String longestPalindrome(String s) { int start = 0, end = -1; StringBuffer t = new StringBuffer("#"); for (int i = 0; i < s.length()原创 2021-11-10 20:29:03 · 128 阅读 · 0 评论 -
《移动项目实践》实验报告——Android Studio环境搭建
实验内容安装JAVA JDK,并配置环境变量;安装Android Studio,熟悉AS的基本操作,改变AS的字体,显示方式;截图和文字说明。建立新项目,实现Hello World。说明各个文件的作用,以及各个关键语句的作用或含义,给出程序的运行结果。设置生命周期的Log日志,分别执行相关操作。在MainActivity中复写onCreate、onStart、onResume、onPause、onStop、onDestroy 和onRestart;分别在各个方法中添加日志监视语句,例如:Lo原创 2021-09-27 22:15:03 · 5731 阅读 · 0 评论 -
网易2022秋季校园招聘-通用技术A卷-0918
https://gitee.com/shentuzhigang/algorithm/tree/master/exam-netease/exam-netease-20210918编程题第一题解决方案JAVAimport java.util.Scanner;/** * @author ShenTuZhiGang * @version 1.0.0 * @email [email protected] * @date 2021-09-18 18:03 */public class Exa原创 2021-09-18 21:10:05 · 987 阅读 · 0 评论