Sunday, August 12, 2018

Leetcode 404: Sum of left leaves

August 12, 2018

Introduction


It is an easy level tree algorithm. I like to work on the algorithm and spend 20 - 30 minutes on the algorithm.

My practice


Here is my C# code. I made a mistake in my first writing. The leaf node should be checked with condition that left and right child both are null. Line 38 is added after one test case is failed since the non-leaf node is counted.



No comments:

Post a Comment