链表问题汇集

一般链表的问题,都是操作链表的next指针,像一根针线一样,连接着下一个节点.

很多链表的问题,就像"穿针引线"一样,其实就是操纵next指针指向哪里~

leetcode-206 反转链表[1]

leetcode-92 反转链表II[2]

leetcode-83 删除排序链表中的重复元素[3]

leetcode-86 分隔链表[4]

leetcode-328 奇偶链表[5]

leetcode-2 两数相加[6]

leetcode-445 两数相加II[7]



设立链表的虚拟头结点

leetcode-203 移除链表元素[8]

leetcode-82 删除排序链表中的重复元素II[9]

leetcode-21 合并两个有序链表[10]

leetcode-24 两两交换链表中的节点[11]

leetcode-25 K个一组翻转链表[12]

leetcode-147 对链表进行插入排序[13]

leetcode-148 排序链表[14]



不仅仅是穿针引线

双指针技术 (或称"双索引技术)

leetcode-237 删除链表中的节点[15]

leetcode-19 删除链表的倒数第N个节点[16]

leetcode-61 旋转链表[17]

leetcode-143 重排链表[18]

leetcode-234 回文链表[19]

参考资料

[1]

leetcode-206 反转链表: https://dashen.tech/2015/03/01/leetcode-206-%E5%8F%8D%E8%BD%AC%E9%93%BE%E8%A1%A8/

[2]

leetcode-92 反转链表II: https://dashen.tech/2015/03/01/leetcode-92-%E5%8F%8D%E8%BD%AC%E9%93%BE%E8%A1%A8II/

[3]

leetcode-83 删除排序链表中的重复元素: https://dashen.tech/2015/03/01/leetcode-83-%E5%88%A0%E9%99%A4%E6%8E%92%E5%BA%8F%E9%93%BE%E8%A1%A8%E4%B8%AD%E7%9A%84%E9%87%8D%E5%A4%8D%E5%85%83%E7%B4%A0/

[4]

leetcode-86 分隔链表: https://dashen.tech/2015/03/01/leetcode-86-%E5%88%86%E9%9A%94%E9%93%BE%E8%A1%A8/

[5]

leetcode-328 奇偶链表: https://dashen.tech/2015/03/01/leetcode-328-%E5%A5%87%E5%81%B6%E9%93%BE%E8%A1%A8/

[6]

leetcode-2 两数相加: https://dashen.tech/2015/03/01/leetcode-2-%E4%B8%A4%E6%95%B0%E7%9B%B8%E5%8A%A0/

[7]

leetcode-445 两数相加II: https://dashen.tech/2015/03/01/leetcode-445-%E4%B8%A4%E6%95%B0%E7%9B%B8%E5%8A%A0II/

[8]

leetcode-203 移除链表元素: https://dashen.tech/2015/03/01/leetcode-203-%E7%A7%BB%E9%99%A4%E9%93%BE%E8%A1%A8%E5%85%83%E7%B4%A0/

[9]

leetcode-82 删除排序链表中的重复元素II: https://dashen.tech/2015/03/01/leetcode-82-%E5%88%A0%E9%99%A4%E6%8E%92%E5%BA%8F%E9%93%BE%E8%A1%A8%E4%B8%AD%E7%9A%84%E9%87%8D%E5%A4%8D%E5%85%83%E7%B4%A0II/

[10]

leetcode-21 合并两个有序链表: https://dashen.tech/2015/03/01/leetcode-21-%E5%90%88%E5%B9%B6%E4%B8%A4%E4%B8%AA%E6%9C%89%E5%BA%8F%E9%93%BE%E8%A1%A8/

[11]

leetcode-24 两两交换链表中的节点: https://dashen.tech/2015/03/01/leetcode-24-%E4%B8%A4%E4%B8%A4%E4%BA%A4%E6%8D%A2%E9%93%BE%E8%A1%A8%E4%B8%AD%E7%9A%84%E8%8A%82%E7%82%B9/

[12]

leetcode-25 K个一组翻转链表: https://dashen.tech/2015/03/01/leetcode-25-K%E4%B8%AA%E4%B8%80%E7%BB%84%E7%BF%BB%E8%BD%AC%E9%93%BE%E8%A1%A8/

[13]

leetcode-147 对链表进行插入排序: https://dashen.tech/2015/03/01/leetcode-147-%E5%AF%B9%E9%93%BE%E8%A1%A8%E8%BF%9B%E8%A1%8C%E6%8F%92%E5%85%A5%E6%8E%92%E5%BA%8F/

[14]

leetcode-148 排序链表: https://dashen.tech/2015/03/01/leetcode-148-%E6%8E%92%E5%BA%8F%E9%93%BE%E8%A1%A8/

[15]

leetcode-237 删除链表中的节点: https://dashen.tech/2015/03/01/leetcode-237-%E5%88%A0%E9%99%A4%E9%93%BE%E8%A1%A8%E4%B8%AD%E7%9A%84%E8%8A%82%E7%82%B9/

[16]

leetcode-19 删除链表的倒数第N个节点: https://dashen.tech/2015/03/01/leetcode-19-%E5%88%A0%E9%99%A4%E9%93%BE%E8%A1%A8%E7%9A%84%E5%80%92%E6%95%B0%E7%AC%ACN%E4%B8%AA%E8%8A%82%E7%82%B9/

[17]

leetcode-61 旋转链表: https://dashen.tech/2015/03/01/leetcode-61-%E6%97%8B%E8%BD%AC%E9%93%BE%E8%A1%A8/

[18]

leetcode-143 重排链表: https://dashen.tech/2015/03/01/leetcode-143-%E9%87%8D%E6%8E%92%E9%93%BE%E8%A1%A8/

[19]

leetcode-234 回文链表: https://dashen.tech/2015/03/01/leetcode-234-%E5%9B%9E%E6%96%87%E9%93%BE%E8%A1%A8/

本文由 mdnice 多平台发布

你可能感兴趣的:(后端)