Class doubt@dictionary larger

https://ide.codingblocks.com/s/50476

can u plz tell me why we included “flag” and explain whats happening thereafter?

Hey, here flag is used to check if the next subsequence that we are forming is lexicographically greater or not.

can u plzz explain the code?i mean i don’t understand in which step we are checking or what condition we are using that will determine whether the sequence is lexicographically greater or not?

Hi Ayush, you can try to dry-run your code or debug your code for any sample input step by step for the better understanding of the logic. Try to dry-run it, if you still don’t get the logic, reply to this thread.

1 Like

i have already tried several times. I don’t understand how it’s working.