Update Triangle.cpp

a linear space complexity