-
Notifications
You must be signed in to change notification settings - Fork 1
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
Harden tests of Triangular Treasure #194
Comments
I am not sure how to update C, C#, NASM, Rust. They all require 32-bit integer results. It is not reasonable to enforce O(n) solutions with this return type (more than 200_000 tests are required in NASM to eliminate O(n) solutions). Java already uses |
Yes, I think switching to 64 bit type is OK. For a brief moment i even considered testing for inputs which would trigger overflow if multiplied first and divided later, but I dont know if this would be still fair for 7 kyu. |
Unless I am doing something bad or missing something, it seems impossible to make iterative solutions fail in Rust, even using i64, probably due to some compiler optimization, see this fork (random test with |
The Rust compiler knows how to compute the sum of a range efficiently. So the compiled code does not contain any loops and your solution is not iterative. Naive solutions (with I forked your kumite and ran some tests. It seems that the range sum is not optimized on Codewars (which is strange because the docs show let n = rng.gen_range(0..10_i64.pow(9)); |
Ok, thanks, I didn't know that. |
As a follow-up of the deduplication issue #188, the kata Triangular Treasure should have its tests updated to allow only O(1) solutions.
List of languages to change:
The text was updated successfully, but these errors were encountered: