Create a component that finds the maximum depth of a hardcoded nested array and displays the depth.
HardProblem Statement
Create a component that finds the maximum depth of a hardcoded nested array and displays the depth.
Sample Input
[1, [2, [3, [4]]]]
Sample Output
Maximum Depth: 4
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 MaxDepth = () => { return ( <div> {/* Display the maximum depth */} </div> ); }; export default MaxDepth;