摘要:
https://leetcode.com/problems/valid-parentheses/ 原题: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the i 阅读全文
摘要:
https://leetcode.com/problems/remove-nth-node-from-end-of-list/ 原题: Given a linked list, remove the nth node from the end of list and return its head. 阅读全文
摘要:
https://leetcode.com/problems/longest-common-prefix/ 原题: Write a function to find the longest common prefix string amongst an array of strings. 思路: 简单 阅读全文
摘要:
https://leetcode.com/problems/integer-to-roman/ 原题: Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 阅读全文
摘要:
https://leetcode.com/problems/roman-to-integer/ 原题: Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 阅读全文
摘要:
Determine whether an integer is a palindrome. Do this without extra space. 思想: 先计算出这个整数的逆序数,然后比较它和原来的数每位是否都相同即可。另外要注意负数没有回文数,还应该考虑overflow一定不是回文数。 AC代 阅读全文
摘要:
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 阅读全文
摘要:
Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 思想:一个整数的倒序,没啥说的,在long类型上比较来避免overflow。 AC代码: 1 class Soluti 阅读全文
摘要:
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 阅读全文