一般情况获取子节点,通过找到查找父节点的ID或者class类名,来获取父节点,再通过children属性,得到子节点的数组: 之前在另外一篇随笔中说过,如果使用另一个属性childNode,会把注释.空文本.非空文本.标签都当做子节点,所以不要使用childNode属性. var father = document.getElementById("ID名"): 或 father = document.getElementsByClassName("class类名")
[抄题]: Given a binary tree, return the tilt of the whole tree. The tilt of a tree node is defined as the absolute difference between the sum of all left subtree node values and the sum of all right subtree node values. Null node has tilt 0. The tilt o