Ad
  • Default 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.

  • Default 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.

  • Default 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 ...

  • Default 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.

  • Default 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.

  • Default 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.

  • Default 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...

  • Default User Avatar

    Do you really need to calculate factorial of numbers > 20! ?

  • Default 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.

  • Default User Avatar

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

    The index is counted from zero upward.

  • Default User Avatar

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

  • Default User Avatar

    Divide et impera

  • Default 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));
            }
        }
    
  • Default 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

    "hob has to learn C++" is a secondary matter. in the first place, i have to know it's C++ because if I don't know this, which language should I learn? :D

  • Loading more items...