/**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
class Solution {
public int kthLargest(TreeNode root, int k) {
List<Integer> list=new LinkedList<>();
f(root,list);
return list.get(k-1);
}
public void f(TreeNode root,List<Integer> list){
if(root!=null){
f(root.left,list);
list.add(0,root.val);
f(root.right,list);
}
}
}