longest palindromic substring 1d array dp solution

https://leetcode.com/problems/longest-palindromic-substring

I saw a solution with 1-d dp.

image

  • Are you able to explain what is each column in 1d array tracking?
  • Why j-i<2? Should it be j-i<3. i.e. a; aa; aaa 3.
  • I ran the code on paper. I can see that each column is refreshing in each iteration. Are you able to explain what is happen to the array in 1 iternation?
Comments (0)