QSTRING Testcase explanation

In the example the substrings are a -> 1 1, a -> 2 2, aa -> 1 2. So in Select 1 1 why 1 1 is answer ? 1 1 is the substring a, but there a no substrings which are lexicographically smaller than a. Also there is one substring a -> 2 2 which is equal to it but it has l = 2 which greater than the left subscript of a -> 1 1. Can somebody point what am I missing here ?


I agree, the problem statement is not clearly explained. First, what does it mean “different substring”? Do you mean distinct or what?
And then, the test cases make the problem statement even more fuzzier. I don’n mean to be rude, but problem statements and test cases should clearly explained without ambiguities. Especially for this kind of problems that usually appear in various contests, since the experienced programmers don’t ask questions probably because they solved something similar 100 times. Give people a chance to solve the problems, this will not make them less worth.


A substring in this question when compared with itself is considered both lexicographically larger and equal with larger left subscript. To match your explanation just decrement k1 and k2 by 1.

1 Like

Can someone have a look ?