Ad
  • Custom User Avatar

    I for the love me can't understand how this one ain't the most upvoted both as clever and best practices

    hats off for avoiding regex altogether, I tried the same and had 10x the numer of locs

  • Custom User Avatar

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

  • Custom User Avatar

    Good point, I don't remember if I did this for a good reason, but given that I initialize bits to 0 I think that & may be superfluous.

  • Custom User Avatar

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

  • Custom User Avatar

    Great point, I swing languages very often and some don't have that notation so that betrayed me here

  • Custom User Avatar

    For the C version:

    • meaning of arguments should be properly documented
    • return value should be properly documented (there is a typo which makes things worse)
    • the test code should not be so generic, it is very cumbersome to read and understand
    • does not specify what to return if there are only T or F values
  • Custom User Avatar

    It didn't but Rust is very picky about type conversions, u32 is what https://doc.rust-lang.org/std/char/fn.from_digit.html takes. You can cast with "as" but it is not ideal. If this causes problems to existing people who passed the test then I agree that we shouldn't change it.

  • Custom User Avatar

    In Rust (and any strongly typed language really) the digit should be unsigned