Problem 4063 · Medium

Longest Subarray Divisible by K with At Most One Negation I

Track, for each remainder, the earliest start of subarrays with and without one negation, so the longest valid window is found in one pass.

Open the interactive visualisation