Find Deepest Maximum Element
Find Deepest Maximum Element
Find the maximum element at the deepest level of a nested array.
Requirements:
- Find the deepest level in nested arrays
- Find maximum value at that level
- Handle multiple levels of nesting
Example:
Input: [1, [2, [3, 4]], [5]]
Output: 4
Explanation: Deepest level is [3, 4], max is 4
Input: [1, 2, [3, [4, 5, [6]]]]
Output: 6
Examples:
Input 1:
{"arr":[1,[2,[3,4]],[5]]}Output 1:
4Input 2:
{"arr":[1,2,[3,[4,5,[6]]]]}Output 2:
6Loading editor...
Run your code to see results
Click the Run button above