Morgan and a String

  • + 3 comments

    I suspect that I don't understand lexicographic minima. My code solves test cases 0-6, 8, and 9 and fails the others. Looking at test cases 13 and 16, I see that the instances which fail (one in each test case set) are very similar.

    A. Given two and only two distinct characters, A and B, where A is less than B, construct a (long!) string, L, such that there is no substring of identical characters of length greater than 2.

    B. Create two test strings: A+L and L

    It seems to me that the solution should always be A+L+L, and this is what my code produces.

    However, this differs strikingly from the solution given, which is A+L+apparently random string matching condition A above.

    So what am I missing?

    Thanks!