Leetcode[669] Trim a Binary Search Tree

Difficulty

  • Level: Medium
  • Acceptance: 64.2%

Solution

Time Complexity: O(n), Space Complexity: O(n)

Analysis

I solved this problem using recursion which calls upon the function again for the left and right node until the function reaches the furthest child nodes.

I have a passion for coding.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store