Fork me on GitHub
摘要: 首先,对于链表来说,我们不能像数组一样直接访问,所以我们想到要求倒数第K个节点首先要知道最后一个节点。 然后从最后一个节点往前数K个。 最后得到想要的值。 但是这是不对的,为什么呢?因为题目给出的是单向链表,只能从前往后找。 所以我们需要换一种思路。 定两个指针。 都从链表的头开始走,一个先走一个后 阅读全文
posted @ 2016-11-27 23:53 LinkinStar 阅读(592) 评论(0) 推荐(0) 编辑
摘要: "Wow," Mike said. "It's snowing."I looked at the little cotton fluffs that were building up along the sidewalk and swirling erratically past my face. 阅读全文
posted @ 2016-11-27 11:38 LinkinStar 阅读(149) 评论(0) 推荐(0) 编辑