/*** Definition for a binary tree node.* public class TreeNode {* int val;* TreeNode left;* TreeNode right;* TreeNode(int x) { val = x; }* }*/classSolution{publicTreeNodelowestCommonAncestor(TreeNode root,TreeNode p,TreeNode q){// 叶子结点 & 已经找到 p or q 的情况下返回 rootif(root ==null|| root == p || root == q){return root;}TreeNode right =lowestCommonAncestor(root.right, p, q);TreeNode left =lowestCommonAncestor(root.left, p, q);// left == null的情况,说明两结点都在root的右侧if(left ==null){return right;}// 类似上,都在左侧if(right ==null){return left;}// 否则说明分布在root的左右两侧,那么root就是最近公共父结点。return root;}}
一、linux关机命令:1.shutdown命令安全地将系统关机(推荐)参数说明:[-r] 重启计算器。[-h] 关机后关闭电源〔halt〕。[-c] cancel current process取消目前正在执行的关机程序。[-time] 设定关机〔shutdown〕前的时间。shutdown -h now 立刻…