Leetcode 1567. Maximum Length of Subarray With Positive Product

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

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.

elliotdunlo
Автор

Good Explaination and Approach... Thanx Fraz

KashyapBavadiya
Автор

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);

PushpendraSingh-bxiz
Автор

crystal clear explanation!! Thanks brother.

The.Monika.Chauhan
Автор

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.

pranavdharkar
Автор

Thank you so much for the explanation.

lkoh
Автор

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.

snehel
Автор

Very beautiful explanation. An easy problem though.

ishanpandey
welcome to shbcf.ru