EPIJudge icon indicating copy to clipboard operation
EPIJudge copied to clipboard

Minor: Change method signature in accordance with test

Open abuggin opened this issue 5 years ago • 3 comments

image There is a test that strictly enforce the return to be None, but the signature requires the method to return always a BinaryTreeNode.

Since you're already making use of typing I wanted to highlight that you could use Optional that exactly covers this use case, imho.

Optional[X] is equivalent to Union[X, None].

abuggin avatar Feb 18 '20 11:02 abuggin

Hi @Bhudjo ,

It looks good to me, and I just wondering that why our solution is OK with this but your solution is having issue.

tsunghsienlee avatar Feb 19 '20 02:02 tsunghsienlee

why our solution is OK with this but your solution is having issue.

Since the signature was -> BinaryTreeNode: and my background is not Python, I returned a BinaryTreeNode even thought it was an empty one.

Like return BinaryTreeNode() or something similar.

When I saw the test failing and understanding that for null case wanted null response, I realized that I made this mistake because the signature was wrong, as far as I understood it.

abuggin avatar Feb 21 '20 20:02 abuggin

@abuggin Hi there, sorry for the long wait. I'll check this out right after I do my state exams at the end of June. I'll keep you updated :)

metopa avatar Jun 07 '20 08:06 metopa