摘要: Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.Summary: When meeting C/X/I, remembers to search forward to check if there is a bigger number at the front. 1 int romanToInt(string s) { 2 if(s.size() == 0) 3 return 0; 4... 阅读全文
posted @ 2013-11-02 13:37 假日笛声 阅读(403) 评论(0) 推荐(0) 编辑
摘要: Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as1and0respectively in the grid.For example,There is one obstacle in the middle of a 3x3 grid as illustrated below.[ [0,0,0], [0,1, 阅读全文
posted @ 2013-11-02 12:38 假日笛声 阅读(206) 评论(0) 推荐(0) 编辑
摘要: A robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below).How many possible uni 阅读全文
posted @ 2013-11-02 12:16 假日笛声 阅读(197) 评论(0) 推荐(0) 编辑