Ad
  • Custom User Avatar

    Recursion seems to be one of the solutions, once you have a blueprint

  • Custom User Avatar

    I second this, or just freaking array would make more sense. The problem says to return a [x, y], I shouldn't have to poke through the test cases to figure it wants an vector with 2 entries.

  • Custom User Avatar

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

  • Custom User Avatar

    Thanks man, its working now

  • Custom User Avatar

    You are probably getting tabs and spaces somehow mixed up in your solution. The problem is not related to sorting.

    Check in your IDE if you use spaces and tabs for indentation consistently. Initial solution does indeed use both (and it's not good), but you have to be really unlucky to get bitten by it in such small stub :)

  • Custom User Avatar

    In python when I'm trying to sort I getting this. I don't understand why.

    array2.sort()
                 ^
    IndentationError: unindent does not match any outer indentation level
    

    Thanks.

  • Custom User Avatar

    @hobovsky: thanks!
    Fixed.

  • Custom User Avatar

    This test is correct, and other tests also seem to be correct, but I think you could mix up tests cases which you failed. Please see here to confirm: https://github.com/codewars/codewars.com/wiki/Troubleshooting-your-solution#how-can-i-see-which-input-causes-my-solution-to-fail

    If you are sure you are failing exactly this test, you can share your code so we can take a look.

  • Custom User Avatar

    Then one of the built in test is borked I think.

  • Custom User Avatar

    Yes, that's correct.

    the two arrays have the "same" elements, with the same multiplicities.

  • Custom User Avatar

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

  • Custom User Avatar

    Makes sense, cause :: means its in the scope of my Same class?
    I c++ well enough and I have no idea how these tests work in back end so I know better than waiste my time trying to figure that out.
    Like that sample test file doesn't run on its own does it?

    But anyway, thanks!

  • Custom User Avatar

    Kata works OK, but it seems g964 broke initial solution stub when fixing the C++ version of the kata recently. It's not something what would stop you from solving the kata, but you have to be familiar with C++ a bit to know what's wrong. I believe g964 will fix it soon, but until then you can use this code as starting point:

    #include <vector>
    
    class Same {
    public :
        static bool comp(std::vector<int>&a, std::vector<int>&b) {
          // your code
          return false;
        }
    };
    

    Paste this code into "Solution" panel and fill in the method comp with your implementation.

  • Custom User Avatar

    main.cpp:7:1: error: expected unqualified-id
    public :
    ^
    main.cpp:18:16: error: use of undeclared identifier 'Same'
    bool ans = Same::comp(a, b);
    ^
    2 errors generated.

    C++, this doesn't seem to work at all? At first because I am a C++ nub I thought I was having an overflow or something but this happens if you don't touch the code so surely its an error on Codewars side?