The TransCompilator

Solved LeetCode program · 440 of 1,000

#0611 · Valid Triangle Number

Medium Array chunk-09.md

Original English source

Keep a shared sides holding 2, 2, 3, and 4. Sort sides. The final is the last position of sides. The count is 0.
For every first from 0 to final.
For every second from first plus 1 to final.
For every third from second plus 1 to final.
The left is item first of sides. The right is item second of sides. The longest is item third of sides. If left plus right is more than longest, add 1 to count.

Show count.

Open in Playground Browse all 1,000 problems

Expected stdout

3