Skip to content

20. Valid Parentheses.md#7

Open
X-XsleepZzz wants to merge 3 commits into
mainfrom
lilnoahhh-patch-6
Open

20. Valid Parentheses.md#7
X-XsleepZzz wants to merge 3 commits into
mainfrom
lilnoahhh-patch-6

Conversation

@X-XsleepZzz
Copy link
Copy Markdown
Owner

20. Valid Parentheses
Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

An input string is valid if:

Open brackets must be closed by the same type of brackets.
Open brackets must be closed in the correct order.
Every close bracket has a corresponding open bracket of the same type.
次は206. Reverse Linked List

Comment thread 20. Valid Parentheses.md
@@ -0,0 +1 @@
20. Valid Parentheses
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

コードの書き忘れでしょうか?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

まだ完成していないので終わり次第レビュー依頼に投げさせていただきます。
その際はよろしくおねがいいたします

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

失礼しました!!

Comment thread 20. Valid Parentheses.md
(https://discord.com/channels/1084280443945353267/1201211204547383386/1202541275115425822)
上の用語わからなすぎて調べる。
おそらく形式言語理論の概念を用いてこの問題を解釈している?
うちの学校のカリキュラムにはないが、形式言語理論の勉強はSWEとして必須?
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

多くの人が一応知っている感じはありますが、あまり聞かれないやつです。

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

そうだったんですね。余力があれば勉強してみます!

Comment thread 20. Valid Parentheses.md Outdated
2回目3分38
3回目2分48

'''python
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

バッククォート`です。

Comment thread 20. Valid Parentheses.md
```python
class Solution:
def isValid(self, s: str) -> bool:
valied_input = ["(",")","{","}","[","]"]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

valid_input = "(){}[]"
というのでも in で判定できます。

Comment thread 20. Valid Parentheses.md

https://github.com/yus-yus/leetcode/pull/6
かなり勉強になった。
特に問題文にはないが、brackets以外が入力として与えられた場合も考えているのがすごくためになった。
Copy link
Copy Markdown

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.

4 participants