Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
classes
I was trying Console.Error.WriteLine...
Thank you !
You can print it with
Console.WriteLine
, it will appear in tests output panelHello.
I'm wondering how comes this Kata is classed <5 kyu>...
Index verification, division, and modulo, seriously ?
Did I miss something ?
This comment is hidden because it contains spoiler information about the solution
Very clever, {5 | 7} + 6x !
Testing 1/3 of the possible divisors, good !
I achieved 26% ;-)
Just one flaw : the (i*i < n) condition in the for loop, is executed at every iteration. Better calculating the Sqrt(n) once for all.
Looks like untidy code ?
Actually, it takes between 1 and 6 comparaisions for numbers < 49;
Then, it checks for divisors between 7 and floor(sqrt(n)) that aren't multiple of 2/3/5 ( { 7, 11, 13, 17, 19, 23, 29, 31 } + (30 * i) ).
That means, checking 26% of the possible divisors, in place of 50%.
(a + 1)² = a² + 2a + 1
This comment is hidden because it contains spoiler information about the solution