 I had my best years in '95 and '96."
Though he ended up having a productive relationship with Sosa, Baylor vowed never to change his style, calling it "constructive criticism."
Said Mark Grace in 2000: "He tells it like it is. He came out the other day and said I wasn't hitting the ball out of the infield. I have no problem with that because he was right."
Baylor took the Rockies to the playoffs in their third season in 1995 but got bounced after six seasons (440-469). His 2001 Cubs finished 88-74, but President Andy MacPhail fired him after the 2002 team slumped to a 34-49 record.
At the time, left fielder Moises Alou was one of the few who spoke up for Baylor, saying: "I feel so bad because Don was so supportive of me. This team hasn't played the way it should be playing. It's not his fault. It's our fault."
Baylor's in-game strategy reflected the times. He favored sacrifice bunts even when his bottom-of-the-lineup hitters repeatedly failed to drive in runners.
As a player, Baylor once told a reporter: "Once I get in a groove, I really don't care who the (other) outfielders are out there."
His teammates nicknamed him "Groove," and it stuck. The 1979 American League MVP with the Angels, Baylor hit.260 for his career with 338 home runs and 1,276 RBIs and was hit by a pitch 267 times, the fourth-highest all-time total.
Regarding his push to have Sosa improve his defense and baserunning, Baylor explained it like this: "I've been a Laker fan all my life. When Phil (Jackson) came in and told Shaq (O'Neal), 'You're going to improve your free-throw shooting,' Shaq accepted it and said, 'I'm going to work on my game.' And he ends up being the MVP."
Part of Baylor's charm was that he did not sound like a politician. He left behind some memorable, albeit awkward, sayings in the mold of Casey Stengel.
He called a player's return from injury a "50-50 long shot."
He said of one of his teams: "We haven't found our gel yet."
And of its bullpen: "It's an improvement that we have to upgrade."
"A lot of guys will be self-evaluating themselves," he said.
"This year," he said early in the 2001 season, "all the puzzles fit."
Baylor had his own way. He will be missed.---
layout: post
title: 897. Increasing Order Search Tree
subtitle: Easy
author: <NAME>
tags: [Coding, LeetCode, DFS, Tree]
image: 
comments: true
published: true
---

Given a binary search tree, rearrange the tree in in-order so that the leftmost node in the tree is now the root of the tree, and every node has no left child and only 1 right child.

Example 1:
```
Input: [5,3,6,2,4,null,8,1,null,null,null,7,9]

       5
      / \
    3    6
   / \    \
  2   4    8
 /        / \ 
1        7   9

Output: [1,null,2,null,3,null,4,null,5,null,6,null,7,null,8,null,9]

 1
  \
   2
    \
     3
      \
       4
        \
         5
          \
           6
            \
             7
              \
               8
                \
                 9  
```
**Note**:

1. The number of nodes in the given tree will be between 1 and 100.
2. Each node will have a unique integer value from 0 to 1000.

## Solutions
### 1. DFS-中序遍历
　　比较 naive 的解法……
```python
# Time Complexity: O(n)
# Space Complexity: O(n)
# Definition for a binary tree node.
# class TreeNode:
#     def __init__(self, x):
#         self.val = x
#         self.left = None
#         self.right = None

class Solution:
    def increasingBST(self, root: TreeNode) -> TreeNode:
        if not root:
            return None
        seq = []
        self.dfs(root, seq)
        return self.build(seq)
    
    def dfs(self, root, seq):
        if not root:
            return
        self.dfs(root.left, seq)
        seq.append(root.val)
        self.dfs(root.right, seq)
    
    def build(self, seq):
        if not seq:
            return None
        root = TreeNode(seq[0])
        node = root
        for i in range(1, len(seq)):
            cur_node = TreeNode(seq[i])
            node.right = cur_node
            node = cur_node
        return root
# Runtime: 104 ms, faster than 41.51% of Python3 online submissions for Increasing Order Search Tree.
# Memory Usage: 14 MB, less than 8.33% of Python3 online submissions for Increasing Order Search Tree.
```

### 2. DFS-递归
　　待解释。
```python
# Time Complexity: O(n)
# Space Complexity: O(n)
# Definition for a binary tree node.
# class TreeNode:
#     def __init__(self, x):
#         self.val = x
#         self.left = None
#         self.right = None

class Solution:
    def increasingBST(self, root: TreeNode) -> TreeNode:
        return self.dfs(root, None)
    
    def dfs(self, root, pre):
        if not root:
            return pre
        res = self.dfs(root.left, root)
        root.left = None
        root.right = self.dfs(root.right, pre)
        return res
# Runtime: 104 ms, faster than 41.51% of Python3 online submissions for Increasing Order Search Tree.
# Memory Usage: 13.9 MB, less than 8.33% of Python3 online submissions for Increasing Order Search Tree.
```
## References
1. [897. Increasing Order Search Tree](https://leetcode.com/problems/increasing-order-search-tree/)
2. [897. Increasing Order Search Tree 递增顺序查找树](https://www.cnblogs.com/grandyang/p/10970623.html)GROOT / SECRET WARS / RENEW YOUR VOWS / ARMOR WARS / YEARS of FUTURE PAST [Reviews]: Beginning is the End is the Beginning!
This is it. The beginning of the end of the Marvel Universe, Yes, yes…the Secret Wars have been going on for a while, but this is IT! We here at GodHatesGeeks are taking a close look at the crossover event of the year, and just what titles are worth your time, money, and eye-muscle strength. “El Sacerdote” here, and I’m here to help you take a look at what’s going down.
As the comic opens, we are brought to the brink of the impending collision of Earth-1610 (the Ultimate Universe) and Earth-1616 (the “traditional” Marvel Universe). It is the calm before the storm, and it is tense. In a story as sprawling, thrilling, action-packed, bombastic, and epic (“epic” in the proper, literary stance, not in the modern way the word is used). Jonathan Hickman (The Manhattan Projects, The Secret Warriors) writes in enough moments for each character to have their moment to shine, and there are more characters packed into these 50 pages than would have thought possible. As the beginning of the end of the Secret Wars (as it’s been quite a build-up these past few months), this story has it all.
Esad Ribic’s (Namor: The Sub-mariner) art has a great sense of scale and perspective, making the action very concise and easy to follow. And everywhere our familiar Marvel heroes wear the most weary expression of desperation on their faces. And desperate they are, as the destruction of both worlds is a foregone conclusion, and only Reed Richards (both of them, from both universes) has a desperate plan save at least a few of our favorite characters. And there are little moments sprinkled here and there that add a lot of emotion, and a bit of unexpected humor (such as the Kingpin inviting super-villains out to watch the end of the universe from a bar, up until the Punisher shows up to get one last mission) that is refreshing. As much as it’s all about the explosions and fighting, the pace definitely builds and eb