Integer to Roman
摘要:没想到哈希表insert插入是性能这么差,把哈希表该为数组后,运行时间减少了100msclass Solution {public: typedef pair Sdata; string intToRoman(int num) { Sdata pattern[] = { ...
阅读全文
posted @
2015-06-21 13:54
xgcode
阅读(132)
推荐(0)
Roman to Integer
摘要:class Solution {public: int romanToInt(string s) { int data[26] = {0}; data['I'-'A'] = 1; data['V'-'A'] = 5; data['X'-'A'] = 10; data['L'-'...
阅读全文
posted @
2015-06-21 12:12
xgcode
阅读(130)
推荐(0)
ZigZag Conversion
摘要:class Solution {public: enum { down = 0, up = 1, }; string convert(string s, int numRows) { string result; int index = 0; in...
阅读全文
posted @
2015-06-20 11:07
xgcode
阅读(105)
推荐(0)