@shawngao said in Java solution, 6 liner:

A【 if (root.val < L) return trimBST(root.right, L, R);

root.left = trimBST(root.left, L, R); root.right = trimBST(root.right, L, R);】

if (root.val > R) return trimBST(root.left, L, R);

B【if (root.val < L) root.left = trimBST(root.right, L, R);

if (root.val > R) root.right trimBST(root.left, L, R);】

why is the answer to B different to A?(I'm a new one ,so the question may be some stupid...)