I just thought of putting the values in a heap and then return the second smallest.

```
class Solution {
public int findSecondMinimumValue(TreeNode root) {
PriorityQueue<Integer> pq = new PriorityQueue<Integer>();
add(root,pq);
if(pq.isEmpty() || pq.size()<3) return -1;
int temp = pq.poll();
while(!pq.isEmpty()){
if(temp!=pq.peek()) return pq.peek();
pq.poll();
}
return -1;
}
public static void add(TreeNode root, PriorityQueue<Integer> pq){
if(root==null) return;
pq.add(root.val);
add(root.left,pq);
add(root.right,pq);
return;
}
}
```

Improvements/feedback appreciated!