Pascal triangle solution.
Added the optimized version.