We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
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.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Trees: Is This a Binary Search Tree?
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.