aiheshan

有多自律,才能有多自由

导航

2018年4月16日 #

UVa 401 - Palindromes

摘要: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=96&page=show_problem&problem=342 题目: 1. 回文数: 一串由字母和数字组成的字符串,正着读和逆着读是相同的 阅读全文

posted @ 2018-04-16 10:04 aiheshan 阅读(202) 评论(0) 推荐(0) 编辑

2018年4月15日 #

UVa 457 - Linear Cellular Automata

摘要: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=94&page=show_problem&problem=398 题目大意: 给定40个培养皿和10个DNS program(10个整数值), 阅读全文

posted @ 2018-04-15 20:14 aiheshan 阅读(430) 评论(0) 推荐(0) 编辑

UVa 414 - Machined Surfaces

摘要: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=94&page=show_problem&problem=355 题目大意: 有一个数字图像设备有N行,每行有25个字符。第一列和第25列都是 阅读全文

posted @ 2018-04-15 19:11 aiheshan 阅读(46568) 评论(0) 推荐(0) 编辑

2016年8月27日 #

leetcode 11. Container With Most Water

摘要: https://leetcode.com/problems/container-with-most-water/ 题目:给定n个非负的数a1...an,其中(i,ai)表示x轴为i,y轴为ai;取任意2个点与x轴的垂直线可以组合成一个容器,假设用这些容器来装水,则其中装水最多的容器可装水多少? 思路 阅读全文

posted @ 2016-08-27 09:49 aiheshan 阅读(164) 评论(0) 推荐(0) 编辑

2016年8月16日 #

leetcode 10. Regular Expression Matching

摘要: https://leetcode.com/problems/regular-expression-matching/ 题目:正则表达式匹配。 '.':匹配任意字符; '*':匹配0个或者多个前一个字符; 由例子可知道。"ab",".*"->true; 可知当*前面为.时,则相当于与匹配任意0或多个字 阅读全文

posted @ 2016-08-16 00:28 aiheshan 阅读(214) 评论(0) 推荐(0) 编辑

2016年8月13日 #

leetcode 8. String to Integer (atoi)

摘要: https://leetcode.com/problems/string-to-integer-atoi/ 题目:将字符串转换为整数。 规则: 1. 输入的字符串前可以有多个空格; 2.遇到'-'或者 '+'或者数字字符开始,为连续的多个数字字符。即遇到其他字符结束; 3. 多个连续数字字符后可以有 阅读全文

posted @ 2016-08-13 22:08 aiheshan 阅读(182) 评论(0) 推荐(0) 编辑

leetcode 7. Reverse Integer

摘要: https://leetcode.com/problems/reverse-integer/ 题目:反转数字。 例如: 输入 -321 输出 -123 思路:题目比较简单,主要是主要32位数字溢出的情况。当反正后数字溢出则输出0. 这里用long型记录反转后的数字,然后强制转换为int型,如果转换后 阅读全文

posted @ 2016-08-13 21:05 aiheshan 阅读(181) 评论(0) 推荐(0) 编辑

leetcode 4. Median of Two Sorted Arrays

摘要: https://leetcode.com/problems/median-of-two-sorted-arrays/ There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median o 阅读全文

posted @ 2016-08-13 20:42 aiheshan 阅读(212) 评论(0) 推荐(0) 编辑

leetcode 5. Longest Palindromic Substring

摘要: https://leetcode.com/problems/longest-palindromic-substring/ 题目:求字符串最长回文串。 第一种思路:以每一个字符为回文串中间的字符时,最长的回文串。考虑回文串字符个数为奇数,偶数的2种情况。 x--,j++ 的向两边扩展,判断最长的回文串 阅读全文

posted @ 2016-08-13 20:41 aiheshan 阅读(186) 评论(0) 推荐(0) 编辑

leetcode 6. ZigZag Conversion

摘要: https://leetcode.com/problems/zigzag-conversion/ 题目: 将字符串转化成zigzag模式。 例如 "abcdefghijkmlnpq" 当为4行,zigzag模式为: 思路:以题目中当行为4的为例,将字符串"abcdefghijkmlnpq" 首先转换 阅读全文

posted @ 2016-08-13 20:39 aiheshan 阅读(292) 评论(0) 推荐(0) 编辑