Solved LeetCode program · 440 of 1,000
#0611 · Valid Triangle Number
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.
Expected stdout
3