Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit52856f2

Browse files
refactor 1248
1 parent619fc55 commit52856f2

File tree

1 file changed

+1
-27
lines changed

1 file changed

+1
-27
lines changed

‎src/main/java/com/fishercoder/solutions/_1248.java

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,11 @@
11
packagecom.fishercoder.solutions;
22

3-
/**
4-
* 1248. Count Number of Nice Subarrays
5-
*
6-
* Given an array of integers nums and an integer k. A subarray is called nice if there are k odd numbers on it.
7-
*
8-
* Return the number of nice sub-arrays.
9-
*
10-
* Example 1:
11-
* Input: nums = [1,1,2,1,1], k = 3
12-
* Output: 2
13-
* Explanation: The only sub-arrays with 3 odd numbers are [1,1,2,1] and [1,2,1,1].
14-
*
15-
* Example 2:
16-
* Input: nums = [2,4,6], k = 1
17-
* Output: 0
18-
* Explanation: There is no odd numbers in the array.
19-
*
20-
* Example 3:
21-
* Input: nums = [2,2,2,1,2,2,1,2,2,2], k = 2
22-
* Output: 16
23-
*
24-
* Constraints:
25-
* 1 <= nums.length <= 50000
26-
* 1 <= nums[i] <= 10^5
27-
* 1 <= k <= nums.length
28-
* */
293
publicclass_1248 {
304
publicstaticclassSolution1 {
315
publicintnumberOfSubarrays(int[]nums,intk) {
326
for (inti =0;i <nums.length;i++) {
337
for (intj =0;j <nums.length;j++) {
34-
8+
//TODO: implement it
359
}
3610
}
3711
return -1;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp