We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
原题:
题目的意思,给定一个字符串,返回不包含相同字符的最长子串的长度 采用滑动窗口的形式
/** * @param {string} s * @return {number} */ var lengthOfLongestSubstring = function(s) { var res = 0, i = 0, j = 0 var length = s.length var set = new Set() while(i < length && j < length) { if(!set.has(s.charAt(j))) { set.add(s.charAt(j++)) res = Math.max(res, j - i) } else { set.delete(s.charAt(i++)) } } return res }; lengthOfLongestSubstring("abcabcbb")
The text was updated successfully, but these errors were encountered:
No branches or pull requests
原题:
![](https://camo.githubusercontent.com/3fa5313ae50b2874caa149a61cc318fde95edd4176c8ffc2b6e87ab4668c1895/68747470733a2f2f7773312e73696e61696d672e636e2f6c617267652f61643966313139336c793166753965386b746d62336a32306a7330356d6d78672e6a7067)
题目的意思,给定一个字符串,返回不包含相同字符的最长子串的长度
采用滑动窗口的形式
The text was updated successfully, but these errors were encountered: