LeetCode题解(19)--Remove Nth Node From End of List
摘要: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.
阅读全文
LeetCode题解(14)--Longest Common Prefix
摘要:https://leetcode.com/problems/longest-common-prefix/ 原题: Write a function to find the longest common prefix string amongst an array of strings. 思路: 简单
阅读全文
LeetCode题解(12)--Integer to Roman
摘要: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
阅读全文
LeetCode题解(13)--Roman to Integer
摘要: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
阅读全文
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
阅读全文
LeetCode题解(2)-- Add Two Numbers
摘要:原题: https://leetcode.com/problems/add-two-numbers/ You are given two linked lists representing two non-negative numbers. The digits are stored in reve
阅读全文
LeetCode题解(1)--Two Sum
摘要:原题: https://leetcode.com/problems/two-sum/ Given an array of integers, find two numbers such that they add up to a specific target number. The functio
阅读全文