LC: 426. Convert Binary Search Tree to Sorted Doubly Linked List
https://leetcode.com/problems/convert-binary-search-tree-to-sorted-doubly-linked-list/
Last updated
https://leetcode.com/problems/convert-binary-search-tree-to-sorted-doubly-linked-list/
Last updated
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.
Input: root = [2,1,3]
Output: [1,2,3]Input: root = []
Output: []
Explanation: Input is an empty tree. Output is also an empty Linked List.Input: root = [1]
Output: [1]/*
// Definition for a Node.
class Node {
public int val;
public Node left;
public Node right;
public Node() {}
public Node(int _val) {
val = _val;
}
public Node(int _val,Node _left,Node _right) {
val = _val;
left = _left;
right = _right;
}
};
*/
class Solution {
public Node treeToDoublyList(Node root) {
}
}