Ad
  • Custom User Avatar
  • Custom User Avatar

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

  • Custom User Avatar

    I really liked the challenge, however as a person who learned to program from Ruby, may I suggest to expand on the instruction or the tests, it took me a couple of tries to understand was it was that the challange wanted from the user. Other than than that, great challenge. Looking forward for more.

  • Custom User Avatar

    Actually, shouldn't it be ["123"]?

    This answer is incorrect.

  • Custom User Avatar

    This solution violates the 'S' in SOLID design (methods should be single-purpose). It's an interesting example because it demonstrates the problems with violating single-purpose methods: the other two methods don't need the transpose (which is an expensive op) but are paying the computational cost to avoid replicating the code to handle the edge cases.

    I also wasn't willing to submit a solution which wasn't DRY, so I refactored my solution progressively after it passed. The edge cases fall out neatly into their own method.

  • Custom User Avatar
    last(1,2,["123"]) # 123
    

    Should be 3