Ad
  • Default User Avatar

    Good point. This solutions does not correctly handle upper camel case.

    The test_solution_randomly function strips the uppercase letter from the start of the sentence with:

                sentence.push_str(&word_selection.next().unwrap()[1..]);
    

    So I take it this problem is only intended for lower camel case.

    The problem statement should probably be made to be more specific.

    I see someone already reported the issue:

    https://www.codewars.com/kata/5208f99aee097e6552000148/discuss/rust#6181ac3bac59440057e75f57

  • Custom User Avatar

    Doesn't this function fail to account for a string that may start with a capital letter?

    Take the example "CamelCase", this function output " Camel Case" instead of the intended "Camel Case".

  • Custom User Avatar

    Well, this is kinda a duh moment for me... I did an iteration version which is wildly unnecessary, if you see this one. If anyone is still wondering how it works, it uses integer division to round down to the nearest whole number before multiplying by the divisor to get the complement.