Problem 2871 · Medium

Split Array Into Maximum Number of Subarrays

If the whole array has a nonzero AND, one subarray is best; otherwise close a segment each time its running AND reaches zero.

Open the interactive visualisation