pass-the-pillow: ZeroDivisionError when n=1

Open Beginner friendly
#8 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python
Domain
backend

Research direction

Start in pass-the-pillow/solution.py at pillowHolder, where n=1 makes cycle zero. Reproduce the ZeroDivisionError with pillowHolder(1, t) for a positive t, then verify that the function returns 1 for this case without changing existing behavior for valid n values.

Written by the indexing model from the issue text.

Description

bug

Calling `pillowHolder(1, t)` for any `t > 0` raises `ZeroDivisionError` because `cycle` is 0.

File: `pass-the-pillow/solution.py`

Impact: Latent bug masked by LeetCode's constraint `2 <= n`.

Suggested fix: Add guard for `n == 1`: return 1.

Dominant language
Python
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from benthomasson/leetcode-implementations

All issues in benthomasson/leetcode-implementations

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.