Hash-Table
LeetCode 160: Intersection of Two Linked Lists
·1 分鐘
LeetCode
Easy
Hash-Table
Linked-List
Two-Pointers
LeetCode 160 解題筆記:兩個指標走完自己的串列就換走對方的,都走 lenA + lenB 步,會同時到達交點或同時到 None
LeetCode 141: Linked List Cycle
·1 分鐘
LeetCode
Easy
Hash-Table
Linked-List
Two-Pointers
Floyds-Cycle-Finding-Algorithm
LeetCode 141 解題筆記:Floyd 判圈,快指針一次兩步、慢指針一次一步,有環就一定會相遇;兩個都要從自己的位置往前走
LeetCode 13: Roman to Integer
·1 分鐘
LeetCode
Easy
Hash-Table
Math
String
LeetCode 13 解題筆記:從左到右加每個符號的值,如果它比右邊的符號小就改成減
LeetCode 1: Two Sum
·1 分鐘
LeetCode
Easy
Array
Hash-Table
LeetCode 1 解題筆記:一邊掃一邊把看過的數存進雜湊表,查 target - x 有沒有出現過;先查再存,同一個元素才不會用兩次