leetcode
kylCeline
这个作者很懒,什么都没留下…
展开
-
leetcode 7&9 : Reverse Integer & Palindrome Number
leetcode 7 : Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 思路: 1.考虑输入的正负。 2.考虑是否越界。 代码:public class Solution { public int reverse(int原创 2015-10-08 10:03:19 · 405 阅读 · 0 评论 -
leetcode 13 : Roman to Integer
Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 思路: 1.首先了解罗马数字: I:1 V:5 X:10 L:50 C:100 D原创 2015-10-10 17:07:11 · 368 阅读 · 0 评论 -
leetcode 14 : Longest Common Prefix
题目: Write a function to find the longest common prefix string amongst an array of strings. 思路: 1.在字符串数组中查找最长的前缀。String中有方法,startsWith(str)可以使用。 2.外层循环遍历字符串数组,内层循环遍历每个字符串,把前缀保存到StringBuffer中。 3,原创 2015-10-13 09:27:27 · 367 阅读 · 0 评论 -
leetcode 263&264: Ugly Number I & II
leetcode原创 2015-10-06 10:40:22 · 538 阅读 · 0 评论 -
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 for better legibility) P A H N A P L S I原创 2015-10-10 10:19:27 · 411 阅读 · 0 评论 -
leetcode 19 :Remove Nth Node From End of List
Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the原创 2015-11-24 09:02:45 · 435 阅读 · 0 评论 -
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 and ask yourself what are the possible input ca原创 2015-10-07 17:00:48 · 407 阅读 · 0 评论