Skip to content
Discussion options

You must be logged in to vote

@LPenny-github

你好 😊

            int firstPointer = 0, secondPointer = input.Length -1;

這裡的 "pointer" 比較偏向 C/C++ 的術語。

就這個題目來說,可以考慮以下的命名方式:

  • firstIndex, secondIndex
  • index1, index2
    • 一般來說 不推薦「變數1、變數2」的命名方式 🤔
    • 但是 這 LeetCode 原題中有提到 "index1", "index2" 多次,可說是這題的特有名詞
    • 所以 在這題的脈絡下,我認為 index1, index2 是 ok 的 😊

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@LPenny-github
Comment options

Answer selected by LPenny-github
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants