[Kotlin] Minimum code to solve with DFS + memo
\n    fun minInsertions(s: String): Int {\n        val cache = Array(s.length) { IntArray(s.length) { -1 } }\n        \n        fun dfs(l: Int, r: Int): Int {\n
```\n    fun minInsertions(s: String): Int {\n        val cache = Array(s.length) { IntArray(s.length) { -1 } }\n        \n        fun dfs(l: Int, r: Int): Int {\n            if (l > r) return 0\n            if (cache[l][r] != -1) return cache[l][r]\n\n            cache[l][r] = if (s[l] == s[r]) {\n                dfs(l+1, r-1)\n            } else {\n                1 + minOf(dfs(l+1, r), dfs(l, r-1))\n            }\n            \n            return cache[l][r]\n        }\n\n        return dfs(0, s.lastIndex)\n    }\n```
['Dynamic Programming', 'Kotlin']