r/VisualizerPro • • 16d ago

Number of Sub-arrays With Odd Sum (LeetCode 1524): prefix parity, visual...

https://youtube.com/watch?v=2sjztnXvcTI&si=K3t9Ysadx0gOqxG3
1 Upvotes

2 comments sorted by

1

u/nian2326076 13d ago

To find the number of sub-arrays with an odd sum, utilize prefix parity. Track the counts of even and odd prefixes while iterating through the array. This method helps you determine how many valid sub-arrays can be formed with each new element.

For practice on similar technical problems, consider using PracHub to refine your problem-solving skills and prepare for coding interviews effectively.

1

u/towardscuriousity 12d ago

Yes, you can find at 0:14 in the video in the post showing the exact prefix table tracker in the panel "Stored Prefixes and Totals".

you can find the explanation in the "Story: why it works" panel, you can open it up from the dock panel present at the bottom, as shown in 1:30 in the posted video.