138. Copy List with Random Pointer
1.問題
一個linked list中每個node除了next之外, 有個random指針會隨機指向list中的任一node, 回傳這個list的deep copy
2.想法
提問
function header, parameter
test input
觀察
用map儲存已經複製過的node, 避免重複拷貝, 重複走訪
說明想法
測試計算複雜度
3.程式碼
Last updated
一個linked list中每個node除了next之外, 有個random指針會隨機指向list中的任一node, 回傳這個list的deep copy
提問
function header, parameter
test input
觀察
用map儲存已經複製過的node, 避免重複拷貝, 重複走訪
說明想法
測試計算複雜度
Last updated