From 8f10ed43a48c4df3e07593231e4d8f1e2110d33d Mon Sep 17 00:00:00 2001 From: Cool <747682928@qq.com> Date: Fri, 4 Oct 2024 17:28:54 +0800 Subject: [PATCH] =?UTF-8?q?2024/10/03=20=E7=81=B5=E7=A5=9E=E9=A2=98?= =?UTF-8?q?=E5=8D=95=20=E6=BB=91=E5=8A=A8=E7=AA=97=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sliding_windows/Num1343.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/main/java/com/cool/ling_cha_mount/sliding_windows/Num1343.java diff --git a/src/main/java/com/cool/ling_cha_mount/sliding_windows/Num1343.java b/src/main/java/com/cool/ling_cha_mount/sliding_windows/Num1343.java new file mode 100644 index 0000000..dc77982 --- /dev/null +++ b/src/main/java/com/cool/ling_cha_mount/sliding_windows/Num1343.java @@ -0,0 +1,33 @@ +package com.cool.ling_cha_mount.sliding_windows; + +/** + * Created with IntelliJ IDEA. + * + * @Author: Cool + * @Date: 2024/10/04/17:28 + * @Description: 1343. 大小为 K 且平均值大于等于阈值的子数组数目 + * DayNumber 1 + * Hard 2 + * Level 3 + * Score 1317 + */ +public class Num1343 { + public int numOfSubarrays(int[] arr, int k, int threshold) { + int res=0; + int sum=0; + for(int i=0;i=k*threshold){ + res++; + } + for(int i=k;i=k*threshold){ + res++; + } + } + return res; + } +}