import java.util.*;
public class Solution {
List<TreeNode> list = new ArrayList<>();
TreeNode KthNode(TreeNode pRoot, int k)
{
if(pRoot == null || k <= 0){
return null;
}
mid(pRoot);
if(list.size() < k){
return null;
}
return list.get(k -1);
}
public void mid(TreeNode root){
if(root != null){
if(root.left !=null){
mid(root.left);
}
list.add(root);
if(root.right != null){
mid(root.right);
}
}
}
}