We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
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!
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Morgan and a String
You are viewing a single comment's thread. Return to all 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!