题解 | #找出最长不重复字符的子串#
找出最长不重复字符的子串
http://www.nowcoder.com/practice/5947ddcc17cb4f09909efa7342780048
class Solution {
public:
    /**
     *
     * @param s string字符串
     * @return int整型
     */
    int lengthOfLongestSubstring(string s) {
        // write code here
        map<char, int> mp;
        int start =-1, ans =0;
        for(int i=0;i<s.length();i++){
            if(mp.count(s[i]))
                start = max(start, mp[s[i]]);
            mp[s[i]] = i;
            ans = max(ans, i-start);
        }
        return ans;
    }
};
 投递用友等公司10个岗位
投递用友等公司10个岗位