摘要: https://leetcode.com/problems/reshape-the-matrix/description/ 简单有趣,也稍微窥探了一下matlab 和numpy 里面reshape 的算法。当然现实要比这个题要复杂,比如numpy 里面reshape 可以只接受一个参数,然后自动推导 阅读全文
posted @ 2018-10-11 12:36 Agentgamer 阅读(165) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/binary-tree-tilt/description/ 挺好的一个题目,审题不清的话很容易做错。主要是tilt of whole tree 的定义是sum of all node's tilt 而不是想当然的tilt of root. 阅读全文
posted @ 2018-10-11 11:59 Agentgamer 阅读(141) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/maximum-depth-of-n-ary-tree/description/ 非常简单的题目,连edge case 都没有。思路就是:最大深度 = 孩子的最大深度 + 1 阅读全文
posted @ 2018-10-11 10:20 Agentgamer 阅读(112) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/quad-tree-intersection/description/ 我觉得是用意挺好的一题目。求两个四叉树的逻辑union,可惜测试用例里面居然包含对题目外因素的检查(那个id)懒得弄了。 思路其实挺简单,但是很容易忽略一个edge c 阅读全文
posted @ 2018-10-11 09:51 Agentgamer 阅读(268) 评论(0) 推荐(0)