Ad
  • Custom User Avatar

    i write an O(n) solution. you can refer to it

  • Default User Avatar
  • Custom User Avatar

    It's the shortest, sure, but the best? If I saw this in production code I would be kinda miffed because the return function is indecipherable.

  • Custom User Avatar

    Added to description.

  • Custom User Avatar

    Which language is giving you trouble? Try logging your input. If you still cant figure it out paste your code as a comment with spoiler alert and someone will help.

  • Custom User Avatar

    Which language is giving you trouble? Try logging your input. If you still cant figure it out paste your code as a comment with spoiler alert and someone will help.

  • Custom User Avatar

    It seems that I passed the basic tests, but when I attempt to run the random tests as well, I pass the random ones and I've got an error:
    Test Results:
    Log
    Great work!
    Testing
    Basic tests
    expected 3 to equal 1
    Should work for random tests

    So I passed the random tests, but not the basic ones?
    Maybe it is just me and I skipped something, but I would appreciate an explanation.
    Thanks

  • Custom User Avatar

    This is, in my opinion, an inadequately constrained kata. It never explicitly states that the order of the face (eyes, nose, face) elements will always be the same, you just have to infer it from the test data.

  • Custom User Avatar

    How does std::sort compare pairs? Only the second element? Inserting into a vector however is not optimal. Why don't you just use the original std::vector and overwrite those positions from your evens?

  • Custom User Avatar

    This kata is obviously written by someone whose's not well-versed in English. Skipping this one.

  • Custom User Avatar

    I definitely wouldn't qualify this as "best practices" since it's creating an entirely new string n times (via std::accumulate). This is an O(k * n) solution, when it should be O(n). For high values of n and k this is going to be sluggish.