算法
lisiur
coding
展开
-
动态规划之矩阵连乘
/** * p是一系列矩阵的系数 * n是矩阵的个数 * m[x][y]是当前第x个矩阵到第y个矩阵的最优连乘 * s[x][y]是记录当前第x个矩阵到第y个矩阵的最优断开位置(k) */ void MatrixChain(int *p,int n,int **m,int **s) { for(int i=1;i<=n;i++) { m[i][i] = 0; } for(int原创 2016-03-21 19:26:21 · 308 阅读 · 0 评论 -
396. Rotate Function
Q: Given an array of integers A and let n to be its length. Assume Bk to be an array obtained by rotating the array A k positions clock-wise, we define a "rotation function" F on A as原创 2016-10-14 19:43:51 · 328 阅读 · 0 评论