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.
Actually, it is worse than you thought. I actually don't know if this works at all! I think the Java tests for this Kata are actually broken.
Notice anything? It only says "1 passed" and doesn't mention the other 10 tests!
So it looks like the buggy test code allowed my buggy code to pass. How embarassing. :) Thanks for catching this, btw. I will have to debug my solution and the test code.
I forgot to reset "initialOk" if the remaining squares were bigger than 1x1. So this is my final solution to this problem that should take care of every possibility that could occur.
The given Problem cries for a recursive solution (at least to my eyes ;-) ). The only thing that makes it a bit strange to solve is the fact that only the initial "paper" shouldn't be already a square. If you end up having a square while cutting it, it's fine.
This wouldn't work for a call with "SqInRect.sqInRect(3, 4)" or "SqInRect.sqInRect(6, 4)"
Before iterating over the array a simple length check could throw all walks away, that aren't of the correct size.