LeetCode: 5. Longest Palindromic Substring

Problem: 5. Longest Palindromic Substring

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

Algorithm: https://www.youtube.com/watch?v=nbTSfrEfo6M

https://www.youtube.com/watch?v=nbTSfrEfo6M

Difficulty: Medium

Description:

Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.

Example 1:

Input: “babad”
Output: “bab”
Note: “aba” is also a valid answer.

Example 2:

Input: “cbbd”
Output: “bb”

Solution: 

Language: Swift

Runtime: 36ms
Memory: 4.0MB

Copy to Clipboard