leetcode
Felixabcd
这个作者很懒,什么都没留下…
展开
-
LeetCode第13题--Roman to Integer(Java实现)
LeetCode第13题–Roman to Integer(Java实现)原题Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.解题思路先弄明白什么是罗马数字:这7个符号与10进制阿拉伯数字的对应关系是: I=1;X=10;C=100;M原创 2015-04-08 17:24:24 · 503 阅读 · 0 评论 -
【LeetCode】Merge Intervals
【LeetCode】Merge Intervals题目Given a collection of intervals, merge all overlapping intervals.For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18].分析先对intervals集合按start从小到大排序,last变原创 2015-05-08 14:40:10 · 412 阅读 · 0 评论 -
【LeetCode】Letter Combinations of a Phone Number
【LeetCode】Letter Combinations of a Phone Number题目在手机九宫格键盘上输入一串数字,给出可能打印出来的字符串的集合。分析先做一个map将数字映射到键盘上相应的字母集合。把按键顺序看成深度优先遍历的深度,每次dfs将深度d+1直到d=按键字符串的长度未知,此时即完成了一次按键可能的输出。实现 static Map<Integer, Chara原创 2015-05-08 19:54:45 · 444 阅读 · 0 评论 -
LeetCode第207题--Course Schedule
LeetCode第207题–Course Schedule原题给出课程总数,用不同整数编号表示不同课程,用一个二维数组表示多组先修课程的顺序对。比如:有2门课,要学课程1必须先学课程0,这是有效的。2, [[1,0]]如果有2门课,要学课程1必须先学课程0,要学课程0必须先学课程1,这是无效的。2, [[1,0],[0,1]]需要完成的就是这个方法: public boolean can原创 2015-05-07 15:43:37 · 550 阅读 · 0 评论