Skip to content

104. Maximum Depth of Binary Tree#21

Open
hiroki-horiguchi-dev wants to merge 1 commit into
mainfrom
tree-bst-104
Open

104. Maximum Depth of Binary Tree#21
hiroki-horiguchi-dev wants to merge 1 commit into
mainfrom
tree-bst-104

Conversation

@hiroki-horiguchi-dev
Copy link
Copy Markdown
Owner

@hiroki-horiguchi-dev hiroki-horiguchi-dev self-assigned this Jun 1, 2026
Comment thread tree-bst/104.md
return 0;
}

Stack<Map<TreeNode, Integer>> nodes = new Stack<>();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

cppなので頓珍漢なこと言ってたら申し訳ないんですが、これってpairでなくmapを使用した理由はありますか

Copy link
Copy Markdown
Owner Author

@hiroki-horiguchi-dev hiroki-horiguchi-dev Jun 2, 2026

Choose a reason for hiding this comment

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

Java は標準ライブラリに pair がないからですね、Kotlinには pair どころか triple まであるけど。。
普通に record で書けばよかったのですが、なんで Map 使ったんだろう。
修正します。

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Javaにはpairは無いのですね。
知らなかったので的外れなことを言ってしまいました。
kotlinにはあるのですね、勉強になります。

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.

いえいえ、とんでもないです。
コメントいただけて嬉しいです、ありがとうございます。

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