Skip to content

50. Pow(x, n)#33

Open
skypenguins wants to merge 1 commit into
mainfrom
leetcode/arai60/problem-50
Open

50. Pow(x, n)#33
skypenguins wants to merge 1 commit into
mainfrom
leetcode/arai60/problem-50

Conversation

@skypenguins

Copy link
Copy Markdown
Owner

50. Pow(x, n)


@skypenguins skypenguins self-assigned this Jun 18, 2026
Comment thread memo.md
result *= x

if n < 0:
for i in range(n*(-1)-1):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

演算子の前後に空白がある場合とない場合で統一されていないので、統一したほうが良いです。

スペースを空けることが多いと思います。
https://peps.python.org/pep-0008/?utm_source=chatgpt.com#other-recommendations

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 memo.md
- 時間計算量: $O(\log n)$
- 空間計算量: $O(1)$

- $x = 0$, $n < 0$ の場合では数学的には $0$ の負の累乗、つまり $1 / 0$ になるので未定義であるから、エラーを出しても良い

@h-masder h-masder Jun 18, 2026

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.

おっしゃる通り、仕様として決めることですね。

@skypenguins skypenguins changed the title add memo.md 49. Group Anagrams Jun 21, 2026
@skypenguins skypenguins changed the title 49. Group Anagrams 50. Pow(x, n) Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants