This is a winner tree problem with any condition for winning. Here, the condition for winning would be the minimum value.

public static Integer secondMin(Node root) { if(root.left == null || root.right == null) return Integer.MAX_VALUE; int min; if(root.left.val == root.val) { min = Math.min(root.right.val, secondMin(root.left)); } else { min = Math.min(root.left.val, secondMin(root.right)); } return min; }Basically, you are comparing all the winners except the first winner. That is why you need to go down it's direction and compare with the other members who haven't faced each other in the process.

Time complexity: O(log(N)) where N is the number of players.

Space complexity: O(log(N)) depth of the recusive stack