Ad
  • Custom User Avatar

    "Having a failure share representation with success can lead to failures accidentally being treated as success."
    If you can treat negative length of the side as a success it means you didn't understand the task. You can't have a piece of stick of a negative length.

    "If not knowing about the possible None, that is still better than not knowing about the possible -1, being forced to deal with it is the whole point."
    None can be an indicaion that there occured some case that your code didn't take care of. I still opt for -1 as an indication of no square case.

    "s/brake/break"
    I didn't understand it. Where is it? How did you come across it?

  • Custom User Avatar

    I would like the output to remain integer.

    Both 0 and -1 make equal sense to me, both indicate that there can be no square constructed.

  • Custom User Avatar

    Fair point.

    Mind sharing your opinion on the kata description?

  • Custom User Avatar

    Solutions using sqrt() for validation should no longer pass.
    The one that you posted is not passing anymore for two reasons:

    • it assumes that square can't be constructed using one stick
    • it uses sqrt() for validation

    Thank you for your feedback!
    If there is anything else to fix in any of your issues please reply.
    For now I mark all 3 of them as resolved.

  • Custom User Avatar

    Done :)

  • Custom User Avatar

    I do not know yet how to fix it but I will figure it out.

  • Custom User Avatar

    I found the word "biggest" more suitable and added a section in the description.

    Is it more clear now?

    Thank you for feedback :)

  • Custom User Avatar

    I changed the description. Is it better now?

  • Custom User Avatar

    I added random tests, please try now.

  • Custom User Avatar

    You get two sticks which you can brake into pieces of integer length. Your task is to construct the biggest possible square from those pieces. You need 4 pieces of equal lengths for a square. You have to return the side of the biggest square that you can construct or -1 if your sticks are too short.

    This is my first kata, thanks for feedback.