Problem Statement

Pattern:


Approach:

just iterative inorder traversal, with a max and a count of sorted elments.

<% tp.file.cursor(2) %>

TC : <% tp.file.cursor(3) %> SC : <% tp.file.cursor(4) %>

Notes

Other approaches: https://youtu.be/fqx8z3VepMA