Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difference of Squares Input Validation #35

Open
bushidocodes opened this issue Feb 22, 2022 · 1 comment
Open

Difference of Squares Input Validation #35

bushidocodes opened this issue Feb 22, 2022 · 1 comment

Comments

@bushidocodes
Copy link
Contributor

The difference of squares spec should validate that the parameter is a natural number. It should be sufficient to return -1 in case of error.

@keiravillekode
Copy link
Contributor

There is nothing specifying that the input i32 are signed. If the solution considers them unsigned, the only non-natural number is 0. It would be reasonable to return 0 (or a negative to report error) in this case.

We can consider error checking to be out of scope for this exercise. There are already large i32 values that can't give valid results as the results would not fit in an i32. We are not asking students to detect and reject these values.

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

No branches or pull requests

2 participants