Problem 667 · Medium

Beautiful Arrangement II

Zig-zag between the two ends of a range to produce k distinct differences, then finish in order.

Open the interactive visualisation