2016年2月24日

Palindrome Number

摘要: class Solution {public: bool isPalindrome(int x) { if(x<0) return false; long long y=0; int num=0,value=x; while(x!=0) { num=x%10; x=x/10; y=y*10+num; 阅读全文

posted @ 2016-02-24 13:54 RenewDo 阅读(90) 评论(0) 推荐(0) 编辑

2016年2月23日

Reverse Integer

摘要: 这题主要要考虑越界处理: 负数小于INT_MIN 正数大于INT_MAX 1 class Solution { 2 public: 3 int reverse(int x) { 4 bool isnegative=false; 5 if(x>-10 && x<10) return x; 6 if(x 阅读全文

posted @ 2016-02-23 13:57 RenewDo 阅读(135) 评论(0) 推荐(0) 编辑

Submission Details

摘要: 我是把它看作是“W”型字,并且“V”作为一个处理循环 提交后错了两次:第一次内存预设不够大100变为1000 第二次没考虑边界情况,当输出行为1时,可以不用处理直接输出 1 class Solution { 2 public: 3 string convert(string s, int numRo 阅读全文

posted @ 2016-02-23 13:14 RenewDo 阅读(267) 评论(0) 推荐(0) 编辑

2015年12月17日

Hadoop的datanode,namenode无法启动

摘要: 1、读写权限出错 首先jps检查过后只有datanode没有启动,然后去Hadoop安装目录下的logs文件中找最近一次datanode的日志 (网上有很多种故障,建议最好自己先看看日志自己的故障是不是和别人是一样的,然后在进行排错):org.apache.hadoop.hdfs.server... 阅读全文

posted @ 2015-12-17 21:09 RenewDo 阅读(6200) 评论(0) 推荐(1) 编辑

2015年12月16日

Linux下eclipse与Hadoop配置

摘要: 1、在安装eclipse前应该已经安装好jdk(dk-6u7-linux-x64.bin、jdk1.6.0_07),Hadoop(hadoop-1.0.4)2、然后下载eclipse,网址如下:Eclipse IDE for Java EE Developers | Packageshttp://w... 阅读全文

posted @ 2015-12-16 11:39 RenewDo 阅读(550) 评论(0) 推荐(0) 编辑

2015年11月19日

String to Integer (atoi)

摘要: 这题写的好惨啊,各种情况1、丢弃前面空白和数字后面东西2、数字是会连续输入的或者是和符号一起输出的,中间有其他的字符都会视为无效,数字前有其他字符也会视为无效。3、0777视为777的,注意整数溢出。 1 class Solution { 2 public: 3 int myAtoi(str... 阅读全文

posted @ 2015-11-19 15:37 RenewDo 阅读(127) 评论(0) 推荐(0) 编辑

2015年11月18日

string的empty,size,length等比较

摘要: 1 #include 2 #include 3 4 using namespace std; 5 6 void Display(const string& str) 7 { 8 cout<<"String: "<<str<<endl; 9 cout<<"Empty: "<<st... 阅读全文

posted @ 2015-11-18 18:19 RenewDo 阅读(2180) 评论(0) 推荐(0) 编辑

Implement strStr()

摘要: 1 class Solution { 2 public: 3 int strStr(string haystack, string needle) { 4 if(haystack.empty()&&!needle.empty()) return -1; 5 ... 阅读全文

posted @ 2015-11-18 18:04 RenewDo 阅读(113) 评论(0) 推荐(0) 编辑

Valid Palindrome

摘要: 注意string也是一个容器可以运用一些容器的方法 1 class Solution { 2 public: 3 bool isPalindrome(string s) { 4 string str; 5 string::iterator first=s.b... 阅读全文

posted @ 2015-11-18 16:23 RenewDo 阅读(94) 评论(0) 推荐(0) 编辑

2015年10月25日

Evaluate Reverse Polish Notation

摘要: 1 class Solution { 2 stackstr; 3 public: 4 int evalRPN(vector& tokens) { 5 string c; 6 int opa,opb; 7 for(auto c:toke... 阅读全文

posted @ 2015-10-25 15:37 RenewDo 阅读(140) 评论(0) 推荐(0) 编辑

导航