HF_Cherish

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
上一页 1 ··· 3 4 5 6 7 8 9 10 11 下一页

2015年6月23日

摘要: 1. Question罗马数转为整型,输入确保在1-3999之内。相似的题目是Integer to RomanGiven a roman numeral, convert it to an integer.Input is guaranteed to be within the range from... 阅读全文
posted @ 2015-06-23 22:41 HF_Cherish 阅读(171) 评论(0) 推荐(0) 编辑

摘要: 1. Question给定整数,将其转化为罗马数。输入在1到3999之间。罗马数字的几个基本特点:I:1, V:5, X:10, L:50, C:100, D:500, M:1000相加:数字连写、小的数字在大的数字右边相减:小的数字在大的数字左边罗马数字的限制特点:数字连写仅限I, X, C(即1... 阅读全文
posted @ 2015-06-23 22:35 HF_Cherish 阅读(216) 评论(0) 推荐(0) 编辑

摘要: 1. Question给n个非负整数,在二维坐标系中,将(i,ai)与(i,0)连线,得到n条线。从n条线中找两条,与x轴构成一个非密封容器(容器不能倾斜),使得该容器盛水量最多。Given n non-negative integers a1, a2, ..., an, where each re... 阅读全文
posted @ 2015-06-23 21:51 HF_Cherish 阅读(197) 评论(0) 推荐(0) 编辑

摘要: 1. Question确定一个数是否是回文数。要求不使用额外空间。Determine whether an integer is a palindrome. Do this without extra space.2. Solution如果是负数,就不是回文数。2.1 reverse integer... 阅读全文
posted @ 2015-06-23 21:30 HF_Cherish 阅读(175) 评论(0) 推荐(0) 编辑

摘要: 1. Question将字符串转换为整数,考虑各种输入情况:空格处理:开头空格省略有效数字:从第一个非空格字符开始的是+、-或数字,直到下一个非数字字符结束。加号处理:开头加号省略空串处理溢出处理无效数字处理Implement atoi to convert a string to an integ... 阅读全文
posted @ 2015-06-23 21:19 HF_Cherish 阅读(185) 评论(0) 推荐(0) 编辑

摘要: 1. Question反转一个整数的数位(注意溢出情况)Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -3212. Solution2.1 整除取余法 1 public cla... 阅读全文
posted @ 2015-06-23 21:06 HF_Cherish 阅读(144) 评论(0) 推荐(0) 编辑

2015年6月12日

摘要: 1. Question给定行数,将某字符串转换为zigzag形式,然后按行输出。zigzag形式如:The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you... 阅读全文
posted @ 2015-06-12 23:04 HF_Cherish 阅读(172) 评论(0) 推荐(0) 编辑

摘要: 1. Question求最长回文子串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... 阅读全文
posted @ 2015-06-12 22:35 HF_Cherish 阅读(168) 评论(0) 推荐(0) 编辑

摘要: 1. Question找两个有序数组的中位数。时间复杂度O(log(m+n))There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arr... 阅读全文
posted @ 2015-06-12 16:03 HF_Cherish 阅读(176) 评论(0) 推荐(0) 编辑

摘要: 1. Question求最长无重复字符子串。Given a string, find the length of the longest substring without repeating characters. For example, the longest substring withou... 阅读全文
posted @ 2015-06-12 15:32 HF_Cherish 阅读(163) 评论(0) 推荐(0) 编辑

上一页 1 ··· 3 4 5 6 7 8 9 10 11 下一页