         
         return String(sChars[maxStart ... maxStart + maxLen - 1])
     }
-}+}

/**
 * Question Link: https://leetcode.com/problems/longest-palindromic-substring/
 * Primary idea: 2D Dynamic Programming, update boolean array based on 
 *               current two characters' equity and the previous boolean subarray
 * Time Complexity: O(n^2), Space Complexity: O(n^2)
 *
 */

class LongestPalindromicSubstring {
    func longestPalindrome(s: String) -> String {
        guard s.characters.count > 1 else {
            return s
        }

        let len = sChars.count
        var maxLen = 1
        var maxStart = 0
        var isPalin = Array(repeating: Array(repeating: false, count : len), count : len)
        
        // set palindrome whose len is 1
        for i in 0 ... len - 1 {
