You are viewing a single comment's thread. Return to all comments →
for both this and jongray93's solution, I believe it only works because data is resticted (0 <= data <= 10000 )
Wouldnt they incorrectly return false for any tree containing Integer.MIN_VALUE or MAX_VALUE?
On the other hand, if we use the fact that data is restricted, you can as well start with -1 and 10001 as initial min and max.