Skip to content

Instantly share code, notes, and snippets.

View markckim's full-sized avatar

Mark Kim markckim

  • San Francisco, CA
View GitHub Profile
@markckim
markckim / main.m
Last active May 11, 2016 09:00
finding the longest palindrome substring within a string, dynammic programming approach ~ O(n^2)
// problem: find the longest palindrome substring within a string s
// e.g., if s = "bananas", the longest palindrome substring is "anana"
//
// dynammic solution:
//
// recursion (in words):
// l[i,j] = longest palindrome substring in string s created starting at index i and ending at index j in string s
// l[i,j] could be an empty string if a palindrome is not possible starting at index i and ending at index j
//