| 1 | Push index 0 | 0 | [0] | - | - | - | 0 | 0 | Height: [0:0] Stack: [0] Water: 0 |
| 2 | Pop index 0 (height 0 < current height 1? Yes) | 1 | [] | 0 | - | - | 0 | 0 | Height: [0:0,1:1] Stack: [] Water: 0 |
| 3 | Push index 1 | 1 | [1] | - | - | - | 0 | 0 | Height: [0:0,1:1] Stack: [1] Water: 0 |
| 4 | Push index 2 | 2 | [1,2] | - | - | - | 0 | 0 | Height: [0:0,1:1,2:0] Stack: [1,2] Water: 0 |
| 5 | Pop index 2 (height 0 < current height 3? Yes) | 3 | [1] | 2 | 3 - 1 - 1 = 1 | min(3,1) - 0 = 1 | 1*1=1 | 1 | Height: [0:0,1:1,2:0,3:3] Stack: [1] Water: 1 |
| 6 | Pop index 1 (height 1 < current height 3? Yes) | 3 | [] | 1 | - | - | 0 | 1 | Height: [0:0,1:1,2:0,3:3] Stack: [] Water: 1 |
| 7 | Push index 3 | 3 | [3] | - | - | - | 0 | 1 | Height: [0:0,1:1,2:0,3:3] Stack: [3] Water: 1 |
| 8 | Push index 4 | 4 | [3,4] | - | - | - | 0 | 1 | Height: [0:0,1:1,2:0,3:3,4:0] Stack: [3,4] Water: 1 |
| 9 | Pop index 4 (height 0 < current height 2? Yes) | 5 | [3] | 4 | 5 - 3 - 1 = 1 | min(2,3) - 0 = 2 | 1*2=2 | 3 | Height: [0:0,1:1,2:0,3:3,4:0,5:2] Stack: [3] Water: 3 |
| 10 | Push index 5 | 5 | [3,5] | - | - | - | 0 | 3 | Height: [0:0,1:1,2:0,3:3,4:0,5:2] Stack: [3,5] Water: 3 |
| 11 | Push index 6 | 6 | [3,5,6] | - | - | - | 0 | 3 | Height: [0:0,1:1,2:0,3:3,4:0,5:2,6:1] Stack: [3,5,6] Water: 3 |
| 12 | Pop index 6 (height 1 < current height 4? Yes) | 7 | [3,5] | 6 | 7 - 5 - 1 = 1 | min(4,2) - 1 = 1 | 1*1=1 | 4 | Height: [0:0,1:1,2:0,3:3,4:0,5:2,6:1,7:4] Stack: [3,5] Water: 4 |
| 13 | Pop index 5 (height 2 < current height 4? Yes) | 7 | [3] | 5 | 7 - 3 - 1 = 3 | min(4,3) - 2 = 1 | 3*1=3 | 7 | Height: [0:0,1:1,2:0,3:3,4:0,5:2,6:1,7:4] Stack: [3] Water: 7 |
| 14 | Pop index 3 (height 3 < current height 4? Yes) | 7 | [] | 3 | - | - | 0 | 7 | Height: [0:0,1:1,2:0,3:3,4:0,5:2,6:1,7:4] Stack: [] Water: 7 |
| 15 | Push index 7 | 7 | [7] | - | - | - | 0 | 7 | Height: [0:0,1:1,2:0,3:3,4:0,5:2,6:1,7:4] Stack: [7] Water: 7 |
| 16 | Push index 8 | 8 | [7,8] | - | - | - | 0 | 7 | Height: [0:0,1:1,2:0,3:3,4:0,5:2,6:1,7:4,8:0] Stack: [7,8] Water: 7 |
| 17 | Pop index 8 (height 0 < current height 2? Yes) | 9 | [7] | 8 | 9 - 7 - 1 = 1 | min(2,4) - 0 = 2 | 1*2=2 | 9 | Height: [0:0,1:1,2:0,3:3,4:0,5:2,6:1,7:4,8:0,9:2] Stack: [7] Water: 9 |
| 18 | Push index 9 | 9 | [7,9] | - | - | - | 0 | 9 | Height: [0:0,1:1,2:0,3:3,4:0,5:2,6:1,7:4,8:0,9:2] Stack: [7,9] Water: 9 |
| 19 | Pop index 9 (height 2 < current height 3? Yes) | 10 | [7] | 9 | 10 - 7 - 1 = 2 | min(3,4) - 2 = 1 | 2*1=2 | 11 | Height: [0:0,1:1,2:0,3:3,4:0,5:2,6:1,7:4,8:0,9:2,10:3] Stack: [7] Water: 11 |
| 20 | Push index 10 | 10 | [7,10] | - | - | - | 0 | 11 | Height: [0:0,1:1,2:0,3:3,4:0,5:2,6:1,7:4,8:0,9:2,10:3] Stack: [7,10] Water: 11 |