Ad
  • Default User Avatar

    In this particular case it doesn't make sense.
    Probably author had to cast while developing the solution and then forgot to remove it during final refactoring.

  • Custom User Avatar

    Done. I updated the description and the solution setup.

  • Custom User Avatar

    Great kata, took alot longer than I'd hoped since I finished everything with x and y axis inverted, then butchered it trying to refactor. Very satisfied that my solution worked in the end though!

    One suggestion would be to better clarify the print_state method requirements - I coded it to return a string representation of the board as shown in the comment of the code example. It was only through checking example tests that I knew a List<List> object was required. Maybe change the wording to:

    "...returns an array of arrays of integers, with the x-position, y position and size of each blob in the nested array (type is List<List> for Java), sorted in ascending order by x position, then by y. If there are no blobs, return an empty array..."

  • Custom User Avatar

    OK. I changed wording similar to what you suggested. Thanks :-)

  • Custom User Avatar

    This was a very good one, and made me realise some weaknesses in my planning of more complex tasks. Definitely need to refactor my mess..

    There was also a fair bit of confusion from the queuing rules which I was mired in. Could I suggest:
    "Only people going the same direction as the Lift may enter it, and they do so according to their "queue" order"
    changed to ->
    "Only people going the same direction as the Lift may enter it"
    +
    "People enter accoriding to their "queue" order, but those not able to enter do not block those behind them that can enter"
    or
    "People enter accoriding to their "queue" order, but those those not able to board will move aside for those behind them that can"

    Something to make it clearer that the single floor queue is effectively two queues: the upQueue and the downQueue.

    Very satifsying overall, thank you.

  • Custom User Avatar

    Also, if you have a null reference at arrayOfArrays[i], then the condition:
    if((arrayOfArrays[i].length==0)|| (arrayOfArrays[i]==null))
    Will throw a null pointer exception, since it will try to find the length of the array first. Put the null reference check first and it will enter the if statement correctly:
    if((arrayOfArrays[i]==null) || (arrayOfArrays[i].length==0))

  • Custom User Avatar

    I think I went in the wrong direction here..

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution