This is the code that does the trick against all the examples I have so far... I don't have enough time to post it, but there is a 180-element array I have on my laptop that was not working with the code from the other comment. This was just tricky enough that I thought seeing the way some different monks approached it would be fun. I remain open to other solutions, as this is kind of a fun problem to think about.