Skip to content

Ports - Steph#12

Open
smarchante1 wants to merge 2 commits into
Ada-C11:masterfrom
smarchante1:master
Open

Ports - Steph#12
smarchante1 wants to merge 2 commits into
Ada-C11:masterfrom
smarchante1:master

Conversation

@smarchante1

Copy link
Copy Markdown

No description provided.

Comment thread lib/factorial.rb
# Time complexity: ?
# Space complexity: ?
# Time complexity: O(n)
# Space complexity: O(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.

Please explain your reasoning for your time and space complexity assertions.

Comment thread lib/factorial.rb
raise ArgumentError if number.nil?
if number == 0 || number == 1
return 1
end

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What would happen if I put factorial("5") and would that be a reasonable case to guard against/make work?

Comment thread lib/factorial.rb
result *= (number - i)
i += 1
end
return result

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good work!

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