leetcode第三题(Java)

Longest Substring Without Repeating Characters

class Solution {
    public int lengthOfLongestSubstring(String s) {
        int result=0;
        int front=0;
        int after=0;
        char[] chars = s.toCharArray();
        Map map = new HashMap<>();
        while(afterresult){ // 保存result的最大值
                result = after - front;
            }
            
        }
        return result;
    }
}

看到了提示想到了hashmap  

leetcode第三题(Java)_第1张图片



你可能感兴趣的:(笔记)