this was the geeks for geeks problem of the day today
/* A Binary Tree node
class Node {
int data;
Node left, right;
Node(int item) {
data = item;
left = right = null;
}
}
*/
class Solution {
ArrayList<Integer> result = new ArrayList<>();
// Function to return a list containing the inorder traversal of the tree.
ArrayList<Integer> inOrder(Node root) {
// Code
inOrderHelper(root);
return result;
}
private void inOrderHelper( Node root ){
if( root == null ) return;
inOrderHelper( root.left );
result.add(root.data);
inOrderHelper( root.right );
}
}