摘要:
无重复字符的最长子串 滑动窗口 需要记录左边界left。当右边界移动的时候,如果新加入的字符已经存在,那么需要更新左边界,让left取左边界和上一个字符位置的最大值。 之后更新字符的最新位置,同时更新max class Solution { public int lengthOfLongestSub 阅读全文
posted @ 2022-08-14 18:57
xzh-yyds
阅读(18)
评论(0)
推荐(0)
摘要:
两数相加 循环,每次相加都new一个新的节点 class Solution { public ListNode addTwoNumbers(ListNode l1, ListNode l2) { ListNode head = null, tail = null; int sum = 0; whil 阅读全文
posted @ 2022-08-14 18:54
xzh-yyds
阅读(24)
评论(0)
推荐(0)
摘要:
两数之和 暴力遍历 class Solution { public int[] twoSum(int[] nums, int target) { int n = nums.length; for(int i = 0; i < n; i++){ for(int j = i+1; j < n; j++) 阅读全文
posted @ 2022-08-14 18:51
xzh-yyds
阅读(24)
评论(0)
推荐(0)

浙公网安备 33010602011771号