文章目录 1.参考网址2.第一种解法3.第二种解法 1.参考网址 http://www.cppblog.com/humanchao/archive/2012/11/12/47357.html 2.第一种解法 直接一个while判断下一个不为空,但是时间,空间复杂度高 3.第二种解法