摘要: 1.归并有序数组 归并A,B到A public class Solution { public void merge(int A[], int m, int B[], int n) { int a = m-1, b = n-1; int i = A.length-1; while(a>=0 && b 阅读全文
posted @ 2020-09-13 19:48 菅兮徽音 阅读(237) 评论(0) 推荐(0)
摘要: 1.判断链表中是否有环 public class Solution { public boolean hasCycle(ListNode head) { if (head == null) return false; ListNode slow = head; ListNode fast = hea 阅读全文
posted @ 2020-09-13 19:18 菅兮徽音 阅读(207) 评论(0) 推荐(0)
摘要: Leetcode 3 求无重复字符的最长子串 输入: "pwwkew"输出: 3解释: 因为无重复字符的最长子串是 "wke",所以其长度为 3。请注意,你的答案必须是 子串 的长度,"pwke" 是一个子序列,不是子串。 思路: 判断字符串为空的情况。 把字符串转换为数组。 创建一个大数组用来保存 阅读全文
posted @ 2020-09-13 16:52 菅兮徽音 阅读(567) 评论(0) 推荐(0)