illustrate the nice solution


  • 0
    J

    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:
    0_1487488778414_Example.png


Log in to reply
 

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