leetcode
sinat_26176609
这个作者很懒,什么都没留下…
展开
-
leetcode Integer to Roman
Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. class Solution { public: string intToRoman(int num) { string str[] ={ "M",原创 2015-03-05 05:41:13 · 278 阅读 · 0 评论 -
leet code Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings. string longestCommonPrefix(vectorstring> &strs) { string res=""; int minp=INT_MAX; int n=str转载 2015-03-05 05:06:55 · 261 阅读 · 0 评论 -
leetcode Reverse digits of an integer
Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 class Solution { public: int reverse(int x) { int flag = (x < 0) ? -1 : 1; x *= f原创 2015-02-27 12:40:04 · 315 阅读 · 0 评论 -
leetcode Roman to integer
class Solution { public: int romanToInt(string s) { int output = 0; int val,val_1; int size = s.size(); for (int i = 0; i < s.size(); i++){ val = fun(s[原创 2015-03-05 04:43:45 · 342 阅读 · 0 评论 -
leetcode Two sum
Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers such that they add up to the target, whe转载 2015-03-05 07:44:34 · 303 阅读 · 0 评论