Skip to content

Latest commit

 

History

History
19 lines (10 loc) · 427 Bytes

File metadata and controls

19 lines (10 loc) · 427 Bytes

Binary Tree Coloring Game

LeetCode #: 1145

Difficulty: Medium.

Topics: Tree, depth-first search.

Complexity Analysis

Time complexity: O(n)

In the best case, the solution will visit ((n / 2) + 1) nodes.

In the worst case, the solution will visit each node once.

Space complexity: O(1)

The extra space used is always the same regardless of n.