摘要: Determine whether an integer is a palindrome. Do this without extra space.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinki... 阅读全文
posted @ 2014-11-30 22:30 老徐Bowie 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 任务是判断可能出现的情况:1.空格2.空指针3.首字符是04.首字符是“+”或“-”5.判断边界条件,上界INT_MAX=2147483647,下届INT_MIN=-2147483648,小心判断 1 // 2 // main.cpp 3 // Longest Substring 4 // ... 阅读全文
posted @ 2014-11-30 13:18 老徐Bowie 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 使用马拉车算法,时间复杂度为O(n),算法详细解释在上一篇文章中。//// main.cpp// Longest Substring//// Created by Bowie Hsu on 14/11/21.// Copyright (c) 2014年 Bowie Hsu . All ... 阅读全文
posted @ 2014-11-27 11:13 老徐Bowie 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 这里,我介绍一下O(n)回文串处理的一种方法。Manacher算法.原文地址:http://zhuhongcheng.wordpress.com/2009/08/02/a-simple-linear-time-algorithm-for-finding-longest-palindrome-sub-... 阅读全文
posted @ 2014-11-26 17:29 老徐Bowie 阅读(179) 评论(0) 推荐(0) 编辑
摘要: const定义的常量在超出其作用域之后其空间会被释放,而static定义的静态常量在函数执行后不会释放其存储空间。 static表示的是静态的。类的静态成员函数、静态成员变量是和类相关的,而不是和类的具体对象相关的。即使没有具体对象,也能调用类的静态成员函数和成员变量。一般类的静态函数几乎就是... 阅读全文
posted @ 2014-11-26 13:35 老徐Bowie 阅读(444) 评论(0) 推荐(0) 编辑
摘要: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ... 阅读全文
posted @ 2014-11-25 23:43 老徐Bowie 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 使用双指针,i遍历全部字符,start收集重复的次数,最后不重复出现的字符个数maxx为i-start+1; 1 // 2 3 // main.cpp 4 5 // Longest Substring 6 7 // 8 9 // Created by Bowie Hs... 阅读全文
posted @ 2014-11-24 11:51 老徐Bowie 阅读(132) 评论(0) 推荐(0) 编辑
摘要: //// excercise.cpp// rumen//// Created by Bowie Hsu on 14/11/19.// Copyright (c) 2014年 Bowie Hsu . All rights reserved.//#include "excercise.h"#includ... 阅读全文
posted @ 2014-11-19 20:57 老徐Bowie 阅读(166) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std;//const int max=8;int a[8][8];int main(){ //输入数字n int n; cin>>n; int x=0,y=n-1; //判断边界条件,并为a[1][n-1]赋值 a[x... 阅读全文
posted @ 2014-11-19 14:19 老徐Bowie 阅读(143) 评论(0) 推荐(0) 编辑
摘要: public class test {public static void main(String[] args){ System.out.println(Zigzag("ABCDEM",4));}public static String Zigzag (String str,int n){ S... 阅读全文
posted @ 2014-10-24 22:46 老徐Bowie 阅读(226) 评论(0) 推荐(0) 编辑