Build a component that generates a Pascal’s Triangle for a given hardcoded number of rows.
HardProblem Statement
Build a component that generates a Pascal’s Triangle for a given hardcoded number of rows.
Sample Input
5 (Number of rows)
Sample Output
Pascal's Triangle: [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1], [1, 4, 6, 4, 1]]
Limits
Time: 2s · Memory: 256 MB
Code Editor
Log in to submit00:00
Try your code in this preview. Submit marks it done.
import React from "react"; const PascalsTriangle = () => { return ( <div> {/* Display Pascal's Triangle */} </div> ); }; export default PascalsTriangle;