Why is this code not working for this Question?

Why is this code not working for this Question?


hello @cbcao263
please share the code that u are submitting on leetcode


This is code I submitted on LL
The above code I submitted on CB.

add this case->
image

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.

Okayy Sir.
Sir koi itna jyaada optimized code bhi puch skta hain kya.
Like in O(1) O(1)

Ya jo aapne pehle btaaya tha usse hojayega

@cbcao263

it will depend on question.
for this problem the best time complexity is O(N) only ,u cannot improve it furthur

1 Like