Implement tree column grouping and minimal parentheses fixes | Meta Interview Question