cups cups of lemonade are poured into the top glass. Once a glass is full, whatever keeps flowing into it spills evenly into the two glasses below it, left and right. Overflow from the bottom row lands on the floor.
Return how full glass number glass in row row is (both 0-based), as a number from 0 to 1.cups=3, row=1, glass=0 → 1.0
The top glass takes the first cup, the other two split evenly between the two glasses of the second row, so both are full.
cups=4, row=2, glass=0 → 0.25
Each glass of the second row receives 1.5 cups, and each excess of 0.5 splits in two. The edge glass of the third row gets 0.25.
cups=1, row=3, glass=2 → 0
One cup stays entirely in the top glass; nothing reaches lower rows.
cups=3, row=1, glass=0
1.0
Run checks the first 3 tests in your browser. Submit checks all 186 tests on the server, hidden ones included.