Ad
  • Default User Avatar

    It's probaby because you can get the same number as int, long, string or whatnot. Check it with Console.WriteLine(n.GetType()) to know for sure.

  • Default User Avatar

    Shouldn't the first line have index on first_name + last_name and last_name + first_name instead of 2 times first_name + last_name?

  • Default User Avatar

    Accidentally submitted. This one may fail or succeed randomly, i was trying to understand why it was random and hit submit instead of attempt.

    (The cause turned out to be negative indices that should be treated as positive indices, something that wasn't even mentioned in the description or initial tests).

  • Default User Avatar

    Oh right, i can print that, i forgor 💀.

    My regex is wrong, i know it, i just couldn't figure out why it was failing one of the tests. Now that i printed it, i see that it was the test for 253 total characters limit (and that it's not 7th, it's #8 out of 10 length tests...).

    Thanks for the assist.

  • Custom User Avatar
  • Default User Avatar

    Not sure what you're asking, do you mean which rule are you getting wrong? Which test is the seventh test? Easier for people to answer you if you show the output and argue for why it should be your answer instead of the one the test wants. Or if you're wondering what the input was, then I mean ask what the input was, but, you can print that. All around I'm really confused.

  • Default User Avatar

    My solution [python] is passing all of the tests except one and i have no idea what is wrong because all it says is "value is not what was expected". But what was expected? I only know it's something about length, but i already tried every "missed by one" possible errors and no luck.

    What does the 7th test in the length group test for?

  • Default User Avatar

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

  • Default User Avatar

    Oops, you are right.

    Changed the name back to s in solution setup and in description.

  • Custom User Avatar

    string hides a stardard module and should not be used as parameter name.

  • Custom User Avatar

    I agree Clever flag is more appropriate. But this shows again that Best Practise and Clever don't mean that much. Perhaps a single Upvote button is better.

  • Custom User Avatar

    I disagree. Using a system function to cast the number to string, when bit operations can be used to determine if a bit is set (which is the whole purpose of these operators), is using a rocket launcher to me. The count operation additionally has to view every element.

    Bitwise checks are mostly done, where performance has to be considered. This is why I disagree on this solution being best practice for this particular task.

    Besides, if you'd found this line of code, without the method name, most folks would still not recognize that it counts bits.

    Don't get me entirely wrong, I still think this solution is creative, since is solves the task with minimal effort. I just can't agree on this being best practice.

  • Custom User Avatar

    This is not less rocket launcher than your solution (and not really more than any other one).

  • Custom User Avatar

    I'm not sure why so many think this is elegant and considered to be a best practice.
    You should not shoot with rocket launchers at birds.

  • Custom User Avatar

    For all discussing performance over readability... Usually, the piece of highly optimized code is never read nor changed after it works. One may hide it somewhere in a helpers folder and you ain't gonna see it. So it depends on what you need.

  • Loading more items...