Skip to content

20. Valid Parentheses#6

Open
n6o wants to merge 1 commit intomainfrom
valid-parentheses
Open

20. Valid Parentheses#6
n6o wants to merge 1 commit intomainfrom
valid-parentheses

Conversation

@n6o
Copy link
Owner

@n6o n6o commented Feb 3, 2026

今回の問題

Valid Parentheses - LeetCode

使用言語

Go

次に解く問題

Reverse Linked List - LeetCode

@n6o n6o changed the title valid-parentheses 20. Valid Parentheses Feb 3, 2026
return false
}

if openToClose[openBrackets[l-1]] != r {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

変数で宣言した方が理解しやすいとStep2で思ったが、書き下すときにはできてなかったことにPR作成後に気づきました

lastOpenBracket := openBrackets[l-1]

openBrackets := make([]byte, 0, len(s))

for i := 0; i < len(s); i++ {
if ob, found := closeBracketPair[s[i]]; found {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ob が何の略か、すぐには分かりませんでした。こちらのコメントをご参照ください。
hemispherium/LeetCode_Arai60#10 (comment)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ありがとうございます。

英単語から文字を削って識別子にすると、読み手の認知負荷が上がる場合があります。原則としてフルスペルで記述することをお勧めします。

今後は原則フルスペルで記述するようにします。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants