[toc]
# Leetcode 1312. 让字符串成为回文串的最少插入次数
## 问题描述
[1312. 让字符串成为回文串的最少插入次数 - 力扣(LeetCode)](https://leetcode-cn.com/problems/minimum-insertion-steps-to-make-a-string-palindrome/)
## 算法
### 解法1: 递归
#### 解法1: 实现1:
##### 解法1: 实现1: python
```
class Solution:
def minInsertions(self, s: str) -> int:
if len(s) <= 1:
return 0
if s[0] == s[len(s)-1]:
return self.minInsertions(s[1:len(s)-1])
else:
return 1 + min(self.minInsertions(s[1:]), self.minInsertions(s[:len(s)-1]))
```
#### 解法1: 实现2:
##### 解法1: 实现2: python
```
class Solution:
def minInsertions(self, s: str) -> int:
def minInsertionsRange(i, j): # [i, j)
if j - i <= 1:
return 0