Doubt in my implementation

Here is my code
What can I do more to complete the code :

hello @yashsharma4304

check now->

u need to also keep track of whether x has occured or not.
note variable i is holding index of x (initially it is -1 to indicate no x found so far)

check this as well here we dont need to track last x.

let me know if anything is not clear

1 Like

Ok everything is clear. Thank you for resolving my doubt :slightly_smiling_face:

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.