soulmachine / leetcode

LeetCode题解,151道题完整版。
BSD 3-Clause "New" or "Revised" License
11.27k stars 3.43k forks source link

Validate Binary Search Tree #83

Closed lxieyang closed 8 years ago

lxieyang commented 8 years ago

The previous version will cause wrong answer. The current version fixed that issue. Comparator used.

soulmachine commented 8 years ago

Hi, my code is much shorter than yours, and it can also pass all test cases. Why do we need to change the code?

lxieyang commented 8 years ago

Hi. I double checked the original code. It seems that it's not passing one of the long test cases. Would you check again? Correct me if I'm wrong plz.

soulmachine commented 8 years ago

I submitted my code a few seconds ago, and it accepted.

lxieyang commented 8 years ago

I’ve attached the resulting webpage. Is there a problem with the inconsistency?

On Feb 25, 2016, at 2:08 AM, Frank Dai notifications@github.com wrote:

I submitted my code a few seconds ago, and it accepted.

— Reply to this email directly or view it on GitHub https://github.com/soulmachine/leetcode/pull/83#issuecomment-188645867.

soulmachine commented 8 years ago

I'm sorry, my code in my computer is newer than Github, the code on Github has a problem, I just modified one line and pushed to Github, it should work now

lxieyang commented 8 years ago

Would you also compile the tex file so that the pdf is up-to-date. If there’s any chance, could you also include my version to the tex? I thought it was more clear in terms of thought flow: get the inorder traversal values and then check if valid.

On Feb 25, 2016, at 2:23 AM, Frank Dai notifications@github.com wrote:

I'm sorry, my code in my computer is newer than Github, the code on Github has a problem, I just modified one line and pushed to Github, it should work now

— Reply to this email directly or view it on GitHub https://github.com/soulmachine/leetcode/pull/83#issuecomment-188648879.

soulmachine commented 8 years ago

I will update the PDF, but in this case, your code is also recursive but much verbose than mine, there is no value to adopt your code, thanks