摘要:
链接:https://leetcode-cn.com/problems/container-with-most-water/ 思路 双指针法 代码 class Solution { public int maxArea(int[] height) { int ans = 0; for (int i 阅读全文
摘要:
链接:https://leetcode-cn.com/problems/string-to-integer-atoi/ 代码 class Solution { public int myAtoi(String str) { char[] chars = str.toCharArray(); int 阅读全文
摘要:
链接:https://leetcode-cn.com/problems/reverse-integer/ 代码 class Solution { public int reverse(int x) { int ans = 0; while (x != 0) { int tmp = x % 10 + 阅读全文
摘要:
链接:https://leetcode-cn.com/problems/longest-palindromic-substring/ 思路:中心扩散法 长度为奇数的回文子串中心有一个元素; 长度为偶数的回文子串中心有两个元素; 代码 class Solution { public String lo 阅读全文