标签:span -- 链表 思考 自己 解法 str color 编程
对链表进行反置。例如:
[1] -> [2] -> [3] -> [null]
变成:
[3] -> [2] -> [1] -> [null]。
自己思考的解法如下:
[null] [1] -> [2] -> [3] -> [null]
(p) (c) (n)
[null] <- [1] [2] -> [3] -> [null]
(p) (c) (n)
-------------------------------------
[null] <- [1] [2] -> [3] -> [null]
(p) (c) (n)
[null] <- [1] <- [2] [3] -> [null]
(p) (c) (n)
-------------------------------------
[null] <- [1] <- [2] [3] -> [null]
(p) (c) (n)
[null] <- [1] <- [2] <- [3] [null]
(p) (c) (n)
未完待续。。。
标签:span -- 链表 思考 自己 解法 str color 编程
原文地址:http://www.cnblogs.com/tlz888/p/7173118.html