158. Previous Left Sibling

medium  - accepted / - tried

Given a DOM tree and a target element, please return the previous left sibling.

Like above, the previous left sibling of green <a/> is the blue <button/>. Notice that they don't necessarily have the same parent element.

If no left sibling, then return null.

What is time & space cost of your solution ?

What is time & space complexity of your approach?