LeetCode题解(9)--Palindrome Number
摘要:Determine whether an integer is a palindrome. Do this without extra space. 思想: 先计算出这个整数的逆序数,然后比较它和原来的数每位是否都相同即可。另外要注意负数没有回文数,还应该考虑overflow一定不是回文数。 AC代
阅读全文
LeetCode题解(8)--String to Integer (atoi)
摘要:Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below
阅读全文
LeetCode题解(7)--Reverse Integer
摘要:Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 思想:一个整数的倒序,没啥说的,在long类型上比较来避免overflow。 AC代码: 1 class Soluti
阅读全文
LeetCode题解(6)--ZigZag Conversion
摘要:The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font
阅读全文
LeetCode题解(3)-- Longest Substring Without Repeating Characters
摘要:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo
阅读全文