LeetCode -- 5. 最长回文子串

127 阅读1分钟
给你一个字符串 s,找到 s 中最长的回文子串。

菜的抠脚

    public int maxArea(int[] height) {
        List list = new ArrayList<Integer>();
        int begin =0;
        int end = height.length-1;

        list.add((Math.min(height[begin],height[end]))*(end-begin));
        while(begin < end || end >begin){

            if(height[begin] >=height[end]){
                list.add((Math.min(height[begin],height[end]))*(end-begin));
                end --;

            }else {
                list.add((Math.min(height[begin],height[end]))*(end-begin));
                begin++;

            }

        }
        int max = 0;
        for(Object o : list){
            if(max<(int)o){
                max = (int) o;
                
            }
        }
        return max;
    }
}