摘要: 答案参考:https://www.zhihu.com/people/cxyxiaowu/activities time O(n) space O(1): 双指针法,计算的中心思想为: 左右(包括自身)最低的柱子决定能装多少水,装水的体积为 water_i = min { l_max, r_max } 阅读全文
posted @ 2019-12-05 20:51 Joel_Wang 阅读(161) 评论(0) 推荐(0) 编辑
摘要: time O(n^2*k) space O(n^2) class Solution { public: int palindromePartition(string s, int K) { //分成两步:第一步递归求将下标【i,j】变为回文子串的最小代价cost(i,j); //cost(i,j)= 阅读全文
posted @ 2019-12-05 17:24 Joel_Wang 阅读(267) 评论(0) 推荐(0) 编辑