Array
Easy
Given two non-empty arrays of integers, write a function that determines whether the second array is a subsequence of the first one.
A subsequence of an array is a set of numbers that aren't necessarily adjacent in the array but that are in the same order as they appear in the array. For instance, the numbers [1, 3, 4]
form a subsequence of the array [1, 2, 3, 4]
, and so do the number [2, 4]
. Note that a single number in an array and the array itself are both valid subsequences of the array.
My own
Official answers
option 1
option 2
key point
通過地址找到該單元的記憶體位置
將地址形象化 → 指針
作個比喻,假設將電腦存儲器當成一本書,一張內容記錄了某個頁碼加上行號的便利貼,可以被當成是一個指向特定頁面的指針;根據便利貼上面的頁碼與行號,翻到那個頁面,把那個頁面的那一行文字讀出來,就相當于是對這個指針進行反參考的動作。
快慢指標…
本題雙指標為右邊上面