Problem 611 · Medium

Valid Triangle Number

Count the triples of stick lengths that form a triangle. The visual sorts the lengths and sweeps two pointers inward from the largest side, adding the whole run of valid starts at once.

Open the interactive visualisation