add bottom up and top down solution for triangle.