Problem#

你能操縱一個西洋棋的騎士(Knight)旗子,它只能走 L 字形。

給你一個整數陣列 nums
,如果可以重排成: 其中的整個陣列的相鄰數字的差(s[i+1] - s[i] == s[1] - s[0]
)相同的話代表 true 反之代表 false。
還有兩個整數陣列 L
和 R
,其中 [L[i], R[i]]
代表查詢 nums
中 index 範圍的數字是 true 還 false,會把答案存在陣列並回傳。
nums
大小: $2 \le n \le 500$L
, R
大小: $1 \le m \le 500$