Introduction
It was my algorithm called Leetcode 250: Count univalue subtrees.
My practice
First I was asked to work on the function to check if binary tree has same value. And then I was told to work on the algorithm to count univalue subtrees.
Here is my practice.
I came out the working solutions for both algorithms. But the first one the peer told me to simplify the algorithm. I do not need to use extra two arguments: hasDefaultValue, defaultValue.
I spent 28 minutes from 9:18 PM to 9:46pm to work on the first algorithm, including discussion with the peer. And I spent 41 minutes to work on the second algorithm, and also had a discussion with the peer on different test cases.
No comments:
Post a Comment