摘要:
链接:https://leetcode-cn.com/problems/regular-expression-matching/ 代码 class Solution { public boolean isMatch(String s, String p) { int sl = s.length(); 阅读全文
摘要:
链接:https://leetcode-cn.com/problems/palindrome-number/ 代码 class Solution { public boolean isPalindrome(int x) { if (x < 0 || (x % 10 == 0 && x != 0)) 阅读全文
摘要:
链接: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/zigzag-conversion/ 思路 0 6 12 1 5 7 11 .. 2 4 8 10 3 9 观察可以得到,第一行和最后一行为公是2 * (numRows - 1)的等差数列,首项为0和numRows - 1; 对 阅读全文
摘要:
链接:https://leetcode-cn.com/problems/longest-palindromic-substring/ 思路:中心扩散法 长度为奇数的回文子串中心有一个元素; 长度为偶数的回文子串中心有两个元素; 代码 class Solution { public String lo 阅读全文