Processing math: 100%

Leetcode 876 - Middle of the Linked List

題目

Problem#

給你一個 linked-list 問你能不能回傳中間的 node,如果有兩個中間的,則回傳後者。

  • 1N[i]100
  • 1N.size()100

想法#

照著題目實作即可

  • 時間複雜度: O(n)
  • 空間複雜度: O(1)

AC Code#

Copy
429
Failed to download https://raw.githubusercontent.com/roy4801/solved_problems/master/leetcode/876.cpp
view raw leetcode/876.cpp delivered with ❤ by emgithub