Ad
  • Custom User Avatar

    I agree. If that is a requirment, it should be listed within the problem statment explicitly imo.

  • Custom User Avatar

    Lol when I wrote my code, I was like somebody going to find a cool way to do this even though it's not hard. Great solution!

  • Custom User Avatar

    As a lover of ternary operators, I love it.

    Understandable about readability but super cool.

    I like reading the ternaries with the : as elses (else ifs) and the ? as like returns.

    This may be clear to lots of people, but I'd drop this for extra perspective incase someone is new or not as comfortable with ternaries.

    Happy Coding!

  • Custom User Avatar

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