Problem 3654 · Medium

Minimum Sum After Divisible Sum Deletions

Repeatedly delete a contiguous block whose sum is a multiple of k, closing the gap after each deletion. Return the smallest sum that can remain.

Open the interactive visualisation