Skip to content

[Bounty submission] Add fibonacci() with edge case handling - #10

Open
redx0352-stack wants to merge 2 commits into
gougousongsong:mainfrom
redx0352-stack:krnl-fib-submission
Open

[Bounty submission] Add fibonacci() with edge case handling#10
redx0352-stack wants to merge 2 commits into
gougousongsong:mainfrom
redx0352-stack:krnl-fib-submission

Conversation

@redx0352-stack

Copy link
Copy Markdown

Submission for $50 Bounty: Add fibonacci function with edge case handling

Implements fibonacci(n) in src/math_utils.py per the spec:

  • Returns the 0-indexed nth Fibonacci number (iterative O(n), not recursive)
  • Raises ValueError("n must be non-negative") when n < 0
  • Edge cases handled: 0 -> 0, 1 -> 1

Tests in tests/test_math_utils.py cover:

  • Base cases (0, 1)
  • Small values (2-10)
  • Negative input raises ValueError with the exact expected message
  • Large value (n=20)

Submitted by moneyapi-bounty on behalf of @krnl.

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.

1 participant