摘要: 1 class Solution { 2 public: 3 int reverse(int x) { 4 int e,s,num,k=0; 5 num=x; 6 e=0; 7 if(x<0) 8 nu... 阅读全文
posted @ 2014-11-08 22:06 xcw0754 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public: 3 string countAndSay(int n) { 4 if(n==1) return "1"; 5 string str0="",str1="1"; 6 int i,t,count; 7 ... 阅读全文
posted @ 2014-11-08 22:00 xcw0754 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public: 3 bool isPalindrome(string s) { 4 if(s=="") return true; 5 if(s.length()==1) return true; //单个字符,对称... 阅读全文
posted @ 2014-11-08 21:47 xcw0754 阅读(350) 评论(0) 推荐(0) 编辑
摘要: 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * TreeNode(i... 阅读全文
posted @ 2014-11-08 21:36 xcw0754 阅读(192) 评论(0) 推荐(0) 编辑