摘要: lc3 无重复字符的最长子串 滑动窗口 维护不重复的集合,指针向右平移 class Solution { public int lengthOfLongestSubstring(String s) { Set<Character> set = new HashSet<>(); int n = s.l 阅读全文
posted @ 2022-09-22 21:59 北de窗 阅读(21) 评论(0) 推荐(0)
摘要: lc5 最长回文子串 1 动态规划 class Solution { public String longestPalindrome(String s) { int len = s.length(); if (len < 2) { return s; } int maxLen = 1, begin 阅读全文
posted @ 2022-09-21 21:54 北de窗 阅读(22) 评论(0) 推荐(0)
摘要: 模拟 lc1 两数之和 class Solution { public int[] twoSum(int[] nums, int target) { HashMap<Integer, Integer> map = new HashMap<>(); for (int i = 0; i < nums.l 阅读全文
posted @ 2022-09-21 20:26 北de窗 阅读(36) 评论(0) 推荐(0)
摘要: lc206 反转链表 class Solution { public ListNode reverseList(ListNode head) { ListNode prev = null; ListNode curr = head; while (curr != null) { ListNode n 阅读全文
posted @ 2022-09-21 19:41 北de窗 阅读(14) 评论(0) 推荐(0)