My simple c++ solution
class Solution {\n    public:\n    int lengthOfLongestSubstring(string s) {\n        vector<int> table(256, 0);\n        int maxstr=0, track=0;\n        for(int
    class Solution {\n    public:\n    int lengthOfLongestSubstring(string s) {\n        vector<int> table(256, 0);\n        int maxstr=0, track=0;\n        for(int i=0;i<s.length();i++)\n        {\n            while(table[s[i]])table[s[track++]]=0;\n            table[s[i]]=1;\n            maxstr=max(maxstr, i-track+1);\n            \n        }\n        return maxstr;\n    }\n};
[]