illustrate the nice solution

  • 0

    Re: Proper O(1) space

    The solution is very nice.

    The basis of the algorithm is the BST keep an order of increasing from left to right.
    And the same val are always adjacent.
    So the we can use inorder and handleValue count the count of the same value.

    For Example:

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.