摘要: Given a set ofnon-overlappingintervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times.Example 1:Given intervals[1,3],[6,9], insert and merge[2,5]in as[1,5],[6,9].Example 2:Given[1,2],[3,5],[6,7],[8 阅读全文
posted @ 2013-01-08 15:25 西施豆腐渣 阅读(120) 评论(0) 推荐(0) 编辑
摘要: Given two wordsword1andword2, find the minimum number of steps required to convertword1toword2. (each operation is counted as 1 step.)You have the following 3 operations permitted on a word:a) Insert a characterb) Delete a characterc) Replace a characterclass Solution { public: int minDistance(s... 阅读全文
posted @ 2013-01-08 07:25 西施豆腐渣 阅读(142) 评论(0) 推荐(0) 编辑
摘要: A message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1 'B' -> 2 ... 'Z' -> 26 Given an encoded message containing digits, determine the total number of ways to decode it.For example,Given encoded message"12", it 阅读全文
posted @ 2013-01-08 04:17 西施豆腐渣 阅读(167) 评论(0) 推荐(0) 编辑