Starting in the main folder, process a list of change-folder logs: '../' moves to the parent (staying if already at the main folder), './' stays, and any other 'x/' moves into a child. Return the minimum number of steps needed to return to the main folder afterward, i.e. the final depth. The input is JSON {logs}.
Input: JSON {logs}.
Output: Integer — the final folder depth.
Input: {"logs":["d1/","d2/","../","d21/","./"]}
Output: 2
Explanation: Depth ends at 2.Input: {"logs":["../","../","../"]}
Output: 0
Explanation: Cannot go above main.Input: {"logs":["./"]}
Output: 0
Explanation: Stay in main.1<=logs<=1000