DP,O(n^2),AC