Skip to content

Latest commit

 

History

History

binary-tree-coloring-game

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

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.