2013年6月7日
摘要: 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(x), next(NULL) {} 7 * }; 8 */ 9 class Solution {10 public:11 ListNode *mergeTwoLists(ListNode *l1, ListNode *l2) {12 // Start typing your C/C+... 阅读全文
posted @ 2013-06-07 20:36 宇睿 阅读(151) 评论(0) 推荐(0) 编辑
摘要: // 8ms 1 class Solution { 2 public: 3 string addBinary(string a, string b) { 4 // Start typing your C/C++ solution below 5 // DO NOT write int main() function 6 reverse(a.begin(),a.end()); 7 reverse(b.begin(),b.end()); 8 int c=0; 9 string s;10 ... 阅读全文
posted @ 2013-06-07 16:48 宇睿 阅读(126) 评论(0) 推荐(0) 编辑
摘要: // 12ms 1 class Solution { 2 public: 3 int numTrees(int n) { 4 // Start typing your C/C++ solution below 5 // DO NOT write int main() function 6 int *f=new int[n+1]; 7 int i,j,sum; 8 f[0]=f[1]=1; 9 if(n<2)10 return 1;11 for(i=2... 阅读全文
posted @ 2013-06-07 10:14 宇睿 阅读(131) 评论(0) 推荐(0) 编辑