AlgoUniversity
  • Go Back
Discussion
Nice Subarray :

Author

Manas

Difficulty Level : Medium

Submissions : 246

Asked In : Atlassian

Marks :10

: 4 | : 0

Given an array of integers nums and an integer k. A continuous subarray is called nice if there are k odd numbers on it. Return the number of nice sub-arrays.

Constraints : 1 <= nums.length <= 50000 1 <= nums[i] <= 10^5 1 <= k <= nums.length

Input

The first line contains two integers : n and k The next line contains n space separated integers denoting the array.

Output

An integer denoting the number of nice subarrays.

Example

Input
5 2
1 2 3 4 5
Output
4

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.