Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Create a component that finds the maximum depth of a hardcoded nested array and displays the depth.

Hard

Problem 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

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;