i tried the same thing at the code while(nums[e] != 0 && e < n) leetcode gives heap buffer overflow(index out of bound ) but how it is working on this ide.
I think the condition at line number 27 will always be true because control came to the else loop since it had odd number of negative numbers and in that case sn!=-1 will be surely true Hence we can write line number 27-28 as :- ans = max(ans, max(e-sn-1, en-s);
very helpful and clean code, i implemented the same method as yours which was given in the hint section of the leetcode problem but wrote such a messy code and it didn't worked.
Thank you for the explanation. I couldn't do it at first but after watching the idea behind your solution, I could write the code myself.
nice explanation.
i tried the same thing at the code while(nums[e] != 0 && e < n) leetcode gives heap buffer overflow(index out of bound ) but how it is working on this ide.
Good Explaination and Approach... Thanx Fraz
Thanks Fraz , Understood
I think the condition at line number 27 will always be true because control came to the else loop since it had odd number of negative numbers and in that case sn!=-1 will be surely true
Hence we can write line number 27-28 as :- ans = max(ans, max(e-sn-1, en-s);
Thankyou bhaiya for this session
Great Explanation !!!
Thanks ☺️
crystal clear explanation!! Thanks brother.
Thank you so much for the explanation.
very helpful and clean code, i implemented the same method as yours which was given in the hint section of the leetcode problem but wrote such a messy code and it didn't worked.
Really helpful video, thanks brother
🔥++
Thanks. This is a good one.
Real nice explaination
Very beautiful explanation. An easy problem though.
Thanks a lot...
Clearly explained 🔥
i got a TLE on leetcode
☹️😭