Размер видео: 1280 X 720853 X 480640 X 360
Показать панель управления
Автовоспроизведение
Автоповтор
give him a crown🌟
please solve this one: Selling Pieces of Wood
Thank You 😊
Thank you bhayia
public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) { if(root == null || root == p || root == q) return root; TreeNode leftLca = lowestCommonAncestor(root.left, p, q); TreeNode rightLca = lowestCommonAncestor(root.right, p, q); if(leftLca == null) return rightLca; if(rightLca == null) return leftLca; return root; }
give him a crown🌟
please solve this one: Selling Pieces of Wood
Thank You 😊
Thank you bhayia
public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) {
if(root == null || root == p || root == q) return root;
TreeNode leftLca = lowestCommonAncestor(root.left, p, q);
TreeNode rightLca = lowestCommonAncestor(root.right, p, q);
if(leftLca == null) return rightLca;
if(rightLca == null) return leftLca;
return root;
}