Skip to content

Create 1011.Capacity To Ship Packages Within D Days.md#44

Open
fuga-98 wants to merge 1 commit into
mainfrom
1011.Capacity-To-Ship-Packages-Within-D-Days
Open

Create 1011.Capacity To Ship Packages Within D Days.md#44
fuga-98 wants to merge 1 commit into
mainfrom
1011.Capacity-To-Ship-Packages-Within-D-Days

Conversation

@fuga-98
Copy link
Copy Markdown
Owner

@fuga-98 fuga-98 commented May 14, 2025

```python
class Solution:
def shipWithinDays(self, weights: List[int], days: int) -> int:
assert days
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

個人的には、assert int には不等号を付けたいですね。

loading = 0
required_days = 1
for w in weights:
if w > capacity:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

bisect_left の lo を max(weights) にしているのでここに引っかかることはないと思います。

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.

3 participants