単方向連結リスト

LeetCode

【LeetCode】 206. Reverse Linked List 解答・解説【Python】

はじめに LeetCodeの問題を解答します。 なるべく、問題の和訳と詳細なコメントを書いています。 余裕があれば、複数のアプローチの解答と、実際の面接を想定して英語での解法やコメントを書いています。 様々な...
LeetCode

【LeetCode】 21. Merge Two Sorted Lists 解答・解説【Python】

はじめに ポイント 連結リストを使用した問題です。 この記事で得られること 連結リストを使った初歩的な問題に触れられます。 LeetCode上での連結リストを使った問題の練習になります。 ...
Python

【Python】連結リストの概要・イメージ・実装・使い方を整理

連結リストに関するメモ。 自分が腹落ちすることを優先で自分のイメージで書く。 連結リストについて 概要 通常のリストとの違い Pythonのリストは先に箱を用意しておき、その箱の中に要素を格納していくイメー...
LeetCode

【LeetCode】19. Remove Nth Node From End of List 解答・解説【Python】

学習メモ。 自分の言葉で書くことで理解できていない部分をはっきりさせる。 問題 原文 Given the head of a linked list, remove the nth node from the end of th...
LeetCode

【LeetCode】82. Remove Duplicates from Sorted List II 解答・解説【Python】

問題 原文 Given the head of a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct nu...
LeetCode

【LeetCode】61. Rotate List 解答・解説【Python】

問題 原文 Given the head of a linked list, rotate the list to the right by k places. Example 1: Example 2:...