------
## 最终结论
```python
def max_sum(triangle, n):
    # Start from the second last row and move upwards
    for row in range(n - 2, -1, -1):
        for col in range(row + 1):
            # Update the current cell with the maximum path sum
            triangle[row][col] += max(triangle[row + 1][col], triangle[row + 1][col + 1])
    return triangle[0][0]

# Test cases
assert max_sum([[1], [2,1], [3,3,2]], 3) == 6
assert max_sum([[1], [1, 2], [4, 1, 12]], 3) == 15
assert max_sum([[2], [3,2], [13,23,12]], 3) == 28
```