LCR 140. 训练计划 II
给定一个头节点为 head 的链表用于记录一系列核心肌群训练项目编号,请查找并返回倒数第 cnt 个训练项目编号。
示例 1:
**输入:**head = [2,4,7,8], cnt = 1
**输出:**8
提示:
1 <= head.length <= 100
0 <= head[i] <= 100
1 <= cnt <= head.length
双指针,一个指针比另一个慢cnt,这样快指针遍历结束时,慢指针就是结果
1 | class Solution { |
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.




