Ad
  • Custom User Avatar

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

  • Default User Avatar

    I'd considered this as a possibility but I thought I'd found that ---..-.--- had a different output than ---....---, so I didnt think it would work. Now I'm interested to take another look at it

  • Custom User Avatar

    Give us a substantiation, please.

  • Custom User Avatar

    You have typo in your code and it did not work, It should have been '\0' instead of '\n'.

    So the following fix works.

    string to_postfix(const string& infix) {
      int pos = find(infix.begin(), infix.end(), '\0') - infix.begin();
      return to_postfix_NEW(infix.substr(0, pos)) + infix.substr(pos, infix.size() - pos);
    }
    
  • Default User Avatar

    It says that the frequency-values will never be greater than 100, which means that it can be 100 as well

    Point taken. I've changed the description.

    And also, it must specify that columns are two-space separated from each othe

    It is already clear from the example

    Would have been better to work with ...

    Thanks for your advice. I will try harder next time.

  • Custom User Avatar

    I found this Kata quite ambiguous. It says that the frequency-values will never be greater than 100, which means that it can be 100 as well. It must say "greater or equal". And also, it must specify that columns are two-space separated from each other. Would have been better to work with a general approach that computes how many spaces the columns have to be separated. For instance, the case {10, 10, 10, 9, 9, 9} expects the following answer:

    101010
    # # # 9 9 9
    # # # # # #
    ...
    

    but a better answer would be:

    10 10 10
    #  #  #  9  9
    #  #  #  #  #
    ...
    
  • Custom User Avatar

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

  • Custom User Avatar

    The issue that many people experienced is still present
    (Assertion `to_postfix(infix) == postfix' failed)
    . Consider the following code to fix it:

    #include <algorithm>
    string to_postfix_NEW(const string& infix) {
      // YOUR IMPLEMENTATION
    }
    string to_postfix(const string& infix) {
      int pos = find(infix.begin(), infix.end(), '\n') - infix.begin();
      return to_postfix_NEW(infix.substr(0, pos)) + infix.substr(pos, infix.size() - pos);
    }