Daily Archives: August 7, 2015


[leetcode] Clone Graph

Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. OJ’s undirected graph serialization:Nodes are labeled uniquely.We use # as a separator for each node, and , as a separator for node label and each neighbor of the node.As an example, consider […]


[leetcode] Palindrome Partitioning

Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. For example, given s = “aab”, Return [ [“aa”,”b”], [“a”,”a”,”b”] ] Dynamic Programming. I used vector<vector<string>> dp[s.size()] as dynamic programming array. dp[i] stores all the possible palindrome […]