摘要: Given a roman numeral, convert it to an integer. 阅读全文
posted @ 2013-10-08 00:32 般若一号 阅读(953) 评论(0) 推荐(0) 编辑
摘要: Given an integer, convert it to a roman numeral.给定一个整数转化为罗马数字 阅读全文
posted @ 2013-10-07 01:43 般若一号 阅读(3869) 评论(1) 推荐(0) 编辑
摘要: Determine whether an integer is a palindrome. Do this without extra space. 阅读全文
posted @ 2013-10-06 09:18 般若一号 阅读(1331) 评论(0) 推荐(0) 编辑
摘要: Implement atoi to convert a string to an integer. 阅读全文
posted @ 2013-10-05 12:12 般若一号 阅读(508) 评论(2) 推荐(0) 编辑
摘要: Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 阅读全文
posted @ 2013-10-05 10:56 般若一号 阅读(1231) 评论(0) 推荐(0) 编辑
摘要: 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 I G Y I R And then read line by line: "PAHNAPLSIIGYIR" 阅读全文
posted @ 2013-10-04 12:00 般若一号 阅读(593) 评论(1) 推荐(0) 编辑
摘要: Question:Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest palindromic substring.(给定一个字符串S,在S中找到最长的回文子字符串,假定最长的回文字符串长度是1000,并且在这个字符串中存在唯一的一个最长回文子字符串) 今天做到leetcode上的这个题,没有想到这个题也竟然是百度14年的笔试题,题目大体相同。下面我来分. 阅读全文
posted @ 2013-10-03 21:37 般若一号 阅读(666) 评论(0) 推荐(0) 编辑
摘要: Add Two Numbers 阅读全文
posted @ 2013-10-02 22:48 般若一号 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 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 "bbbbb" the longest substring is "b", with the length of 1.解 阅读全文
posted @ 2013-10-02 22:46 般若一号 阅读(129) 评论(0) 推荐(0) 编辑
摘要: There are two sorted arrays A and B 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)).解决方法(C++版):class Solution {public:double findMedianSortedArrays(int A [], int m, int B [], int n) {int temp = m + n;if (temp & 0x1){r 阅读全文
posted @ 2013-10-02 22:42 般若一号 阅读(130) 评论(0) 推荐(0) 编辑