<p>Given a string <code>s</code>. In one step you can insert any character at any index of the string.</p>

<p>Return <em>the minimum number of steps</em> to make <code>s</code>&nbsp;palindrome.</p>

<p>A&nbsp;<b>Palindrome String</b>&nbsp;is one that reads the same backward as well as forward.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> s = &quot;zzazz&quot;
<strong>Output:</strong> 0
<strong>Explanation:</strong> The string &quot;zzazz&quot; is already palindrome we do not need any insertions.
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> s = &quot;mbadm&quot;
<strong>Output:</strong> 2
<strong>Explanation:</strong> String can be &quot;mbdadbm&quot; or &quot;mdbabdm&quot;.
</pre>

<p><strong class="example">Example 3:</strong></p>

<pre>
<strong>Input:</strong> s = &quot;leetcode&quot;
<strong>Output:</strong> 5
<strong>Explanation:</strong> Inserting 5 characters the string becomes &quot;leetcodocteel&quot;.
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>1 &lt;= s.length &lt;= 500</code></li>
	<li><code>s</code> consists of lowercase English letters.</li>
</ul>

class Solution:
    def getLongestPalindromeSubseq(self, index_1: int, index_2: int, n: int, str_1: str, str_2: str, cache: Dict) -> int:
        if index_1 >= n or index_2 >= n:
            return 0

        elif (index_1, index_2) in cache:
            return cache[(index_1, index_2)]

        elif str_1[index_1] == str_2[index_2]:
            cache[(index_1, index_2)] = 1 + self.getLongestPalindromeSubseq(index_1 + 1, index_2 + 1, n, str_1, str_2, cache)
            return cache[(index_1, index_2)] 

        cache[(index_1, index_2)] = max(
            self.getLongestPalindromeSubseq(index_1 + 1, index_2, n, str_1, str_2, cache),
            self.getLongestPalindromeSubseq(index_1, index_2 + 1, n, str_1, str_2, cache)
        )

        return cache[(index_1, index_2)]

    def minInsertions(self, s: str) -> int:
        rev_s = s[::-1]
        n = len(s)

        cache = dict()
        longest_palindrome_subseq = self.getLongestPalindromeSubseq(0, 0, n, s, rev_s, cache)

        return n - longest_palindrome_subseq
56614