426. Convert Binary Search Tree to Sorted Doubly Linked List

Input: root = [4,2,5,1,3]
Output: [1,2,3,4,5]Explanation: The figure below shows the transformed BST. The solid line indicates the successor relationship, while the dashed line means the predecessor relationship.
Constraints:

--

--

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