#3200

Maximum Height of a Triangle

pupil · 485 · lc easy +27 · 44.2% accepted · 165 likes · top 26%

Description

You are given two integers red and blue representing available red and blue balls. Build a triangle where row 1 has 1 ball, row 2 has 2, row 3 has 3, and so on. All balls in a row must be the same color, and every two consecutive rows must differ in color.

Return the maximum height achievable.

Code

1
2
3