Ad
  • Custom User Avatar

    Dear Sir's Would be nice to add a small hint that strings shall be sorted based on ACII character values.

    ie using StringComparer.Ordinal comparator. Seems default for C# comparator using different logic.

  • Custom User Avatar

    Dear Smileous,

    The logic of your algorithm is quite right, it would generally work absolutely the same way as kanonical BWT, the difference is in the fact that canonical BWT should be expected to work not with letters of text, but with bytes and their values where character 'a' and 'A' are quite different letters having different ACII code values, while your algorithm implement some default C# comparison method with specific comparison logic.

    In order for you to fix your code you shall try to adjust default for C# sort order and to ensure that texts are sorted based on ACII codes of relevant characters.

    I assume that remark regarding sort order would be useful in KATA Description, but it is absolutely not mandatory, and would be not fare to consider it to be KATA issue.

  • Custom User Avatar

    I would write here reply on your old question, just to make a note on my understanding of join statement work.

    Databases are usually working with various data having certain characteristics based on which data could be filtered or sorted.
    If you have two independent sets of data you have to allign certain elements from one set with certain elements from another set.

    I.e. you do something like: for each element from set 1 find elements in set 2.

    In your particular case your request is: For each element in table posts find 2 elements in table categories where id's are equal.

    we took first post, take it category and search for it in table categories, obviouisly your limit statement does not make any sence as soon as for each element form posts table always exists only one record in categories ...

  • Custom User Avatar

    I wander if my solution would work at (3,-2) and if no, that would mean test envioronment does not have sufficient coverage.

  • Custom User Avatar

    Would be nice for a long test to provide some estimation of %% completion.
    '''if(i%(BIG_SIZE/10)==0) printf("%2.0f of the Addition test passed\n",(double)i/BIG_SIZE);'''

    That would give some clue if the solution is on the right track and need only cosmetical enhancments.

  • Custom User Avatar

    The logic behind the calculations of poker haands is straight forward.

    1. The player with rarest defined combination wins. (Straight flush, 4k, 3k+1p, Flush, Straight, 3k,2p,1p,nothing) where *k - is of a kind *p - is pair.
    2. If combinations are equal player with biggest combination cards wins
    3. The reminder is sorted and player with the first card bigger than opponent's wins
    4. The value of ace can be different.

    The whole difficulty of the kata is absence of clear defenition of the requirements...

    What i would suggest is to rephrase text above in better english and add it to description instead or together with wikipedia refference.

  • Custom User Avatar

    In fact you dont need, but the problem states:

    QT

    With these 36 digits we can now encode numbers up to 36!-1

    UNQT

    So in description should be clarified:

    With these 36 digits it is theoretically possible to encode numbers up to 36!-1, but for the purposes of this kata in C version numbers would be always less then ULLONG_MAX

    OR

    So we extend 0..9 with letters A..J. With these 20 digits we can now...

  • Custom User Avatar

    In C in the envioroment of codewars server unsigned long long does not support numbers > 20!.

    So, in this kata C version would be good to state that in description.

    or

    change input and output parameters of the functions from unsigned long long to const char*, but in such case complexity of the kata would increase.

  • Custom User Avatar

    according to the Kata 4041000 is 4*(6!)+4*(4!)+3! == 2982

    The index is counted from zero upward.

  • Custom User Avatar

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

  • Custom User Avatar

    Divide et impera

  • Custom User Avatar

    Finally i found deficiency of my code.

    the empty spaces surrounded by moshpit was not always marked as part of moshpit.

    The following group of tests could filter it out:

    It(all_moshpit_joints_possible)
        {
          const std::vector<std::pair<size_t, size_t>> expected = {{3,4}};
          int j=0;
          for(int i=0;i<8;i++){
            std::vector<std::string> dance_floor = {
                "z??zz",
                "?  ?z",
                "?  ?z",
                "z??z "
            };
            for(auto& row:dance_floor){
              for(auto& col: row){
                if(col == '?'){
                  if(i==j++){
                    col=' ';
                  }
                  else{
                    col = 'z';
                  }
                }
              }
            }
            const auto actual = best_place(dance_floor);
            AssertThat(actual, IsOneOf(expected));
            }
        }
    
  • Custom User Avatar

    Wow, discussion. :)

    1. If C++ is not known and /or solved there is no point to search for deficiency in the test cases any way.
    2. Forfeiting difficulties is not how real "Samurai" shall move his path, thus agree with Hobovsky.
    3. Already stated the language required.
    4. Will do my best to find the problem, if i would have enough time and self motivation resources.
    5. I do not know what was the issue, and thus could not provide any specific portion of the solution and or relevant test case.
  • Custom User Avatar

    For a years of wars i noticed the you are the only person who somehow reacted on my comments.

    My solution is in C++ (Clang8 C++17).

    I believe i can not publish it here. So looking for you in c++ branch.

    And yes, i was much more lasy in this case.

  • Custom User Avatar

    Dear Hobovsky,
    Seems as before you had read my comment a bit too literally.

    Indeed you are right - my comment did not help the author to make the kata better. ( And for that i already stated it is useless and sorry for that )
    Actually, if you were interested to identify the language of tests which pass or not pass you might simply pass the kata, and thereafter look at my only solution.
    Start it couple of times or even cycle it for hundred times and get the conditions at which it would fail.

    Unfortunately i just run my solution once, it pass all the tests, i executed it second time it fail some tests, i was not wondered what was the problem and run the submission for the third time and it pass all the tests again.

    So we know that random test cases coud generate failing tests. Either because some error in authors own solution or in mine. Mine was performed without due care, thus i assume that there is error in it and thus i think that test cases does not cover the solution effectively.

    I believe simple two colums 1000 rows 'moshpit' scene which will end op with ' ','xx',' ' would trigger failure for my solution. But i believe it is not what triger referred error on my submission.

    I.e. i was as laysy as youself and did not performed search by myself, but stated, that isssue exists. And might be someone more motivated would find it out. Otherwise if i knew the answers on your questions i would definitely propose what test must be included...

  • Loading more items...