[LeetCode]003.Longest Substring Without Repeating Characters

Question

Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for “abcabcbb” is “abc”, which the length is 3. For “bbbbb” the longest substring is “b”, with the length of 1.

Solution

  • C
1
2
3
int lengthOfLongestSubstring(char* s) {

}
  • C++
1
2
3
4
5
6
class Solution {
public:
int lengthOfLongestSubstring(string s) {

}
};
  • Java
1
2
3
4
5
public class Solution {
public int lengthOfLongestSubstring(String s) {

}
}
  • JavaScript
1
2
3
4
5
6
7
/**
* @param {string} s
* @return {number}
*/
var lengthOfLongestSubstring = function(s) {

};
  • Python
1
2
3
4
class Solution:
# @param {string} s
# @return {integer}
def lengthOfLongestSubstring(self, s):
  • Swift
1
Hello World
坚持原创技术分享,您的支持将鼓励我继续创作!