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.
+1
Exactly :D
The purpose of this kata is to disallow tampering with instance attributes, so you can forget about removing those tests.
This comment is hidden because it contains spoiler information about the solution
i think you can simple calculate the quotient of (score / debt), sort by that as first criteria, sort by debt as second criteria and use the result as stack, of which you pick items as long as you are below the max debt. At least thats what i did :)
Now you can find them
The run-time of a solution could be updated when you select "compare with my solution" so that you could at least compare the speed of one solution versus your own. I agree that creating a global score would be challenging. Perhaps they could semi-regularly check run times on the top 10 up-voted solutions.
Could you replace n != 0 with n?
Thank you, for feedback.
Of course, for real task it's more logical to use objects, not arrays. But the aim of this kata is to show how to use arrays where content have different types. Later I will try to do this idea using normal objects. I'll try to add more test-cases
I'm glad you liked it! :D
I'm planning on making more katas soon so look out for 'em!
Well this is a bug fixing kata so other solutions aren't exactly following in the spirit of things.
Thank you! This was my first time looking at React myself to be honest. I'm hoping that other developers will be able to come up with even better React Katas! =)
In case you're interested and haven't already heard of it: Programming challenges with the goal of achieving a functionality with the least possible number of characters are called "code golf". Stack Exchange has an exclusive site just for code golf challenges. You will find some brilliant and brain racking solutions every day, and of course are able to sumbit your own ones.
Admittedly, I had to think about that one myself since it wasn't yesterday when i wrote it.
Using
f
as an argument is just a lazy and space saving alternative to declaring it within the function body (see Balkoth's solution for the "clean way"); I really wanted to do this in a compact one-liner ;DThe rest is exactly as you said:
f
starts out as a falsy value and gets negated/toggled every time, so the first zero will be kept, the second zero will be omitted, the third will be kept and so on...Of course, I wasn't smart enough to invent that trick (at least I didn't). This is where I first saw it: Sudoku Solver in 140bytes
function R(a,i,j,m,g){for(i=80;a[i];i--||+a);for(m=10;g=a[i]=--m;g&&R(a))for(j in a)g*=a[j^i==j]^m||i/9^j/9&&i%9^j%9&&i/27^j/27|i%9/3^j%9/3}
Talking about unreadable?
Thanks, man, but let's give credit to debri too for the cool idea :)
Loading more items...