leetcode icon indicating copy to clipboard operation
leetcode copied to clipboard

Fix: Big O in 0235-lowest-common-ancestor-of-a-binary-search-tree.js

Open pobch opened this issue 2 years ago • 0 comments

  • File(s) Modified: 0235-lowest-common-ancestor-of-a-binary-search-tree.js
  • Language(s) Used: javascript

Description

The time complexity of the current solution should be O(H), not O(N) when N is the total number of node and H is the height of the tree (in a specific case H will equal to N).

pobch avatar May 04 '23 10:05 pobch