@@ -0,0 +1,1336 @@
+package com.hackerrank.contests.daysOfCode_30;%0A%0Aimport java.util.Scanner;%0A%0Aclass Node22 %7B%0A%09Node22 left, right;%0A%09int data;%0A%0A%09Node22(int data) %7B%0A%09%09this.data = data;%0A%09%09left = right = null;%0A%09%7D%0A%7D%0A%0Apublic class Day22_BinarySearchTrees %7B%0A%0A%09public static int getHeight(Node22 root) %7B%0A%09%09// Write your code here%0A%09%09if (root == null) %7B%0A%09%09%09return 0;%0A%09%09%7D else %7B%0A%09%09%09// with recursion....%0A%09%09%09// return 1 + Math.max(getHeight(root.left), getHeight(root.right));%0A%09%09%7D%0A%0A%09%09%0A%09%09int left_Height = getHeight(root.left);%0A%09%09int right_Height = getHeight(root.right);%0A%09%09%0A%09%09if (left_Height %3E right_Height) %7B%0A%09%09%09return left_Height + 1;%0A%09%09%09%0A%09%09%7D else %7B%0A%09%09%09return right_Height + 1;%0A%09%09%7D%0A%09%7D%0A%0A%09public static Node22 insert(Node22 root, int data) %7B%0A%09%09if (root == null) %7B%0A%09%09%09return new Node22(data);%0A%09%09%7D else %7B%0A%09%09%09Node22 cur = new Node22(data);%0A%09%09%09if (data %3C= root.data) %7B%0A%09%09%09%09cur = insert(root.left, data);%0A%09%09%09%09root.left = cur;%0A%09%09%09%7D else %7B%0A%09%09%09%09cur = insert(root.right, data);%0A%09%09%09%09root.right = cur;%0A%09%09%09%7D%0A%09%09%09return root;%0A%09%09%7D%0A%09%7D%0A%0A%09public static void main(String%5B%5D args) %7B%0A%09%09// TODO Auto-generated method stub%0A%0A%09%09@SuppressWarnings(%22resource%22)%0A%09%09Scanner sc = new Scanner(System.in);%0A%09%09int T = sc.nextInt();%0A%09%09Node22 root = null;%0A%09%09while (T-- %3E 0) %7B%0A%09%09%09int data = sc.nextInt();%0A%09%09%09root = insert(root, data);%0A%09%09%7D%0A%09%09int height = getHeight(root);%0A%09%09System.out.println(height);%0A%0A%09%7D%0A%0A%7D%0A

Create Day22_BinarySearchTrees.java