type
status
date
slug
summary
tags
category
icon
password

题目

Given a string s, find the length of the longest substring without repeating characters.

解题思路

注意:题目要求的是 substring,而不是subsequence。这道题可以用滑动窗口求解。
解法一:记录每个字符出现的次数,需要保证窗口内每个字符出现的次数不大于 1。
解法二:记录每个字符上一次出现的位置。
Rust 版本
Leetcode 1041. Robot Bounded In CircleLeetcode 4. Median of Two Sorted Arrays