STRINGRA Please help in debugging

aug17
stringra

#1

link text

I have tried very much to debug my code yet i am not able to do so. Please help in debugging the code for the STRINGRA I would be very thankful to you for this :slight_smile:


#2

// We can use the set in this question instead of vector // because the element must be distinct

In the sequence, repetitions are allowed.

Your code prints wrong output for this case-

Input
1
4 8
0 1
0 2
0 4
1 2
1 4
2 3
2 4
3 4
Your Output
1 2 1 3
Correct Output
1 2 2 3

In your output, you have ‘1’ instead of ‘2’. But then, there must be an edge from 1 to 3 as you can add ‘1’ at end of {1} to get {1,1}, a sub-sequence which ends at index 2 (0-based indexing). But There is no such edge, it means that sequence of {arr[0],arr[2]} has already occured before. Meaning element at index 2 is same as element at index 1.