今際の国の呵呵君
Monday, January 21, 2019
[LeetCode]Construct Quad Tree
题目链接
递归地分成四个区间recursively construct即可,注意终止条件。对于可能的叶节点,我们要check所有部位null的子节点都为叶节点并且全为true或者false。时间复杂度O(m * n),m和n为输入举证的行数和列数。注意comment中记录的几个bug,代码如下:
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment