- 博客(7)
- 资源 (4)
- 收藏
- 关注
原创 LeetCode014:Longest Common Prefix
原题目: Write a function to find the longest common prefix string amongst an array of strings. 找到一个字符串数组中,最长的公共前缀子串,并输出。 算法分析: 算法1:各种错误,各种提交不通过,各种特殊情况没考虑,服了! 算法2: 纵向
2016-12-06 22:44:47 554
原创 LeetCode013: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: 从前往后扫描,用一个临时变量记录分段数字。如果当前比前一个大,说
2016-12-06 22:40:35 507
原创 LeetCode12:Integer to Roman
原题目: Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 给定一个数字,将其转换成为罗马数字输出 算法分析: 罗马数字构成: 罗马数字共有7个,即Ⅰ(1)、Ⅴ(5)、Ⅹ(10)、Ⅼ(50)、Ⅽ(100
2016-12-06 22:38:19 449
原创 LeetCode11: Container With Most Water
原题目: Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). F
2016-12-06 22:36:43 508
原创 LeetCode10:Regular Expression Matching
原题目: Implement regular expression matching with support for '.' and '*'. '.' Matches any single character. '*' Matches zero or more of the preceding element. The matching should cover t
2016-12-06 22:34:06 384
原创 LeetCode09:Palindrome Number
原题目: Determine whether an integer is a palindrome. Do this without extra space. click to show spoilers. Some hints: Could negative integers be palindromes? (ie, -1) If you are thinking of c
2016-12-06 22:31:48 351
原创 LeetCode08:String to Integer(atoi)
原题目: Implement atoi to convert a string to an integer. 实现atoi函数,即将字符串转化为整数 算法分析: 函数首先丢弃所需的空格字符,直到找到第一个非空格字符。然后,从该字符开始,采用可选的初始加号或减号,后跟尽可能多的数字,并将其解释为数值。 字符串可以包含在形成整数数字之后的附加字符,这些字符
2016-12-06 22:29:05 522
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人