Plz correct my code

hello @rakesh800650
can u please share the question with me

longest consecutive subsequence

ur code is correct ,just u need to add some minute changes
image

here cnt=1 (because element itself will contribute 1)

also in if statement make sure that ur it!=x.begin()

check ur updated code here->

sir we are getting previous element by

  • prev(it)
    if we want to get next element then what should we we have to write

can u guess it …?

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.