java学习 1504 统计全1子矩形 + python生成ppt部分思路
1.1504统计全1子矩形
class Solution {public int numSubmat(int[][] mat) {if(mat == null || mat.length == 0 || mat[0].length == 0){return 0;}int m = mat.length;int n = mat[0].length;int[][] height = new int[m][n];for(int j = 0;j<n;j++){for(int i = 0;i<m;i++){if(mat[i][j] == 1){height[i][j] = (i ==0) ? 1 :height[i-1][j] + 1;}else {height[i][j] = 0;}}}int count = 0;for(int i = 0;i < m;i++){for(int j =0;j<n;j++){int minwidth = height[i][j];for(int k = j;k>= 0&&minwidth > 0;k--){minwidth = Math.min(minwidth,height[i][k]);count += minwidth;}}}return count;}
}
1.预处理每列的连续1,高度:当前元素mat[i][j]为上一列元素加一(不为0)
2.对于每个位置作为右下角,向左拓展
2.python生成ppt的思路
开源项目参考 https://github.com/limaoyi1/Auto-PPThttps://github.com/limaoyi1/Auto-PPT
分为标题页、目录页、内容页
建立md到ppt的映射关系
对结构分析。内容填充