摘要: Runtime: 4 ms, faster than 46.79% of C++ online submissions for Print Binary Tree. 可以看出,矩阵宽度是所有节点的和,长度是树高+1。然后就是二分,但要注意边界值。 阅读全文
posted @ 2018-12-30 23:17 yuxihong 阅读(176) 评论(0) 推荐(0) 编辑
摘要: On a 2 dimensional grid with R rows and C columns, we start at (r0, c0) facing east. Here, the north-west corner of the grid is at the first row and c 阅读全文
posted @ 2018-12-30 22:51 yuxihong 阅读(128) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, we install cameras on the nodes of the tree. Each camera at a node can monitor its parent, itself, and its immediate children. Ca 阅读全文
posted @ 2018-12-30 20:17 yuxihong 阅读(611) 评论(0) 推荐(0) 编辑
摘要: Return all non-negative integers of length N such that the absolute difference between every two consecutive digits is K. Note that every number in th 阅读全文
posted @ 2018-12-30 17:13 yuxihong 阅读(869) 评论(0) 推荐(0) 编辑
摘要: A binary tree is univalued if every node in the tree has the same value. Return true if and only if the given tree is univalued. 太简单了,签到题。 阅读全文
posted @ 2018-12-30 17:10 yuxihong 阅读(91) 评论(0) 推荐(0) 编辑
摘要: Given a wordlist, we want to implement a spellchecker that converts a query word into a correct word. For a given query word, the spell checker handle 阅读全文
posted @ 2018-12-30 17:09 yuxihong 阅读(331) 评论(0) 推荐(0) 编辑