Practice · 5 of 5
Nesting depth from a spec
CHALLENGE
Difficulty: advanced+25 XP
A log line encodes nested calls with < for *call* and > for *return*. Compute the **maximum nesting depth** reached. If at any point a > occurs when nothing is open (or the log ends with calls still open), the log is malformed: return **-1**. An empty log is well-formed with depth 0. Implement depth(String log).
Press Submit to check your solution.
Back to lesson: Practice: Reading specs like the exam writes them