Manacher's Algorithm – Longest Palindromic Substring
leetcode.com
leetcode.com
Then for each position, you can just binary search for the longest palindrome centered at that position.
On the other hand, there were no further such comments after your post, so maybe one could say that it worked. :-)
What he means is that the total time taken by ALL executions of the inner loop combined is at most N, not that each run of the inner loop takes at most N steps (otherwise it would become quadratic).