
Episode 116: Max Gap Count in C++23
Algorithms + Data Structures = Programs
00:00
I Hate to Admit That I Learned Anything in College
The monoid is based on the fact that every time you hit a max it resets. The property holds even if you you break your sequence or array up into a bunch of chunks whatever result is yielded is the count of the max diff in that chunk. When you merge those chunks together like it's it's monoidal um it'll you'll always end up with the right answer regardless if you're doing a left fold a right fold or some arbitrarily you know tree reductions so so i which is which is so awesome i hate to admit that i might have learned things in college because college was not a pleasant experience for me.
Transcript
Play full episode