LeetCode刷题
LeetCode刷题解答,编程语言为C++
镇天雷帝
这个作者很懒,什么都没留下…
展开
-
leetcode之1343大小为 K 且平均值大于等于阈值的子数组数目
文章目录题目题解代码 题目 给你一个整数数组 arr 和两个整数 k 和 threshold 。 请你返回长度为 k 且平均值大于等于 threshold 的子数组数目。 示例 1: 输入:arr = [2,2,2,2,5,5,5,8], k = 3, threshold = 4 输出:3 解释:子数组 [2,5,5],[5,5,5] 和 [5,5,8] 的平均值分别为 4,5 和 6 。其他长度为 3 的子数组的平均值都小于 4 (threshold 的值)。 示例 2: 输入:arr = [1,1,1,原创 2020-07-16 07:09:25 · 143 阅读 · 0 评论 -
LeetCode54题之转圈打印矩阵
#include <iostream> #include <vector> using namespace std; /*row是行,column是列,缩写为r和c,(upr,upc)是左上角的边界点,(dr,dc)是右下角的边界点 */ void CoutMatrix(vector<vector<int>> matrix, int upr, int upc, int dr, int dc){ if( upr == dr){ for(i原创 2020-05-21 13:47:36 · 186 阅读 · 0 评论