- 博客(10)
- 收藏
- 关注
原创 LeetCode(java)9. Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space.题目描述:判断一个数字是否为回文数组,不允许使用辅存。解法一:将数字x翻转后存于一个long中(防止溢出)leetcode通过时间为:9ms(不推荐,比较用long来解决溢出并不是题目希望的,目前未想到其他解决溢出的方法)public
2016-04-12 16:50:58 222
原创 LeetCode(java)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
2016-04-12 16:45:35 239
原创 LeetCode(java)7. Reverse Integer
Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321题目描述:按位反转数字2种解题思路:①变为StringBuffer,调用reverse函数再调用Integer的valueOf函数,通过捕捉异常判断是否溢出:leetcode通过时间为:
2016-04-10 20:38:44 303
原创 LeetCode(java)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 NA P L S I
2016-04-10 19:43:42 195
原创 LeetCode(java)5. Longest Palindromic Substring
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.题目描述:找出一个字符串中的最长
2016-04-10 19:23:35 235
原创 LeetCode(java)4. Median of Two Sorted Arrays
There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).题目描述:给出两个长度分别为m和n的递增数组num
2016-04-10 18:30:02 276
原创 LeetCode(java)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 for "abcabcbb" is "abc", which the length is 3. For
2016-04-06 15:17:38 170
原创 LeetCode(java)2. Add Two Numbers
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link
2016-04-06 14:50:01 179
原创 LeetCode(java)1. Two Sum
Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution.Example:Given nums =
2016-04-06 12:45:43 180
转载 Java 中String对象比较方法equals和等号==
String s1 = new String("hello"); String s2 = new String("hello"); String s31 = s2; String s32 = new String(s2); String s4 = "hello"; String s5 = "hello"
2016-03-23 21:53:59 765
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人