SHARE
TWEET

Untitled

a guest Apr 19th, 2017 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     private static int strangeCount2(TreeNode node) {
  2.         if (node == null || isLeaf(node)){
  3.             return 0;
  4.         } else if (node.left == null){
  5.             return 1 + strangeCount2(node.right);
  6.         } else if (node.right == null){
  7.             return 1+ strangeCount2(node.left);
  8.         } else {
  9.             return strangeCount2(node.left)+strangeCount2(node.right);
  10.         }
  11.     }
  12.  
  13.     private static boolean isLeaf(TreeNode n) {
  14.         return (n == null) ? false : (n.left == null && n.right == null);
  15.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top