摘要: Write a function to find the longest common prefix string amongst an array of strings.Solution: 1 class Solution { 2 public: 3 string longestCommo... 阅读全文
posted @ 2015-08-08 23:54 irun 阅读(170) 评论(0) 推荐(0)
摘要: Compare two version numbersversion1andversion2.Ifversion1>version2return 1, ifversion1sum2)return 1;16 else if(sum1<sum2)return -1;17 ... 阅读全文
posted @ 2015-08-08 21:10 irun 阅读(137) 评论(0) 推荐(0)
摘要: Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes... 阅读全文
posted @ 2015-08-08 20:14 irun 阅读(144) 评论(0) 推荐(0)
摘要: 12- Integer to RomanGiven an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.Solution: 枚举,考虑每个字符以及每两个... 阅读全文
posted @ 2015-08-08 00:05 irun 阅读(194) 评论(0) 推荐(0)