AC Java Solution using recursion

  • 0
    public class Solution {
        List<Integer> st = new ArrayList<Integer>();  
        public List<Integer> inorderTraversal(TreeNode root) {
            if(root == null) return st;  
            if(root.left != null) inorderTraversal(root.left);  
            if(root.right != null) inorderTraversal(root.right);  
            return st;

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.