摘要: 题目说明: Write a function to find the longest common prefix string amongst an array of strings. 程序代码: #include using namespace std; string longestCommonPrefix1(vector& strs) { int nMinLength... 阅读全文
posted @ 2016-03-24 15:39 Quincy 阅读(350) 评论(0) 推荐(0) 编辑
摘要: 题目说明: Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 程序代码: #include using namespace std; //{'I','V','X','L','C','D','M','#','#'};... 阅读全文
posted @ 2016-03-24 14:43 Quincy 阅读(259) 评论(0) 推荐(0) 编辑
摘要: 题目说明: Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 程序代码: 思路是把数字拆成单独的部分,最后拼接起来 1. 拆分数字,求出每一位数字。 2. 把每位数字单独转换singleDigitToRoman成罗马数字,... 阅读全文
posted @ 2016-03-24 11:04 Quincy 阅读(274) 评论(0) 推荐(0) 编辑