Algorithm · ByteDance · Medium
Problem: Count Nice Subarrays You are given an integer array nums together with an integer k. Call a contiguous portion of the array nice when it includes precisely k odd elements. Determine how many nice subarrays exist. Input Format The first line provides n and k, with n denoting the array length and k specifying the required odd-number count. The second line lists the n values in nums. Output Format Output one integer representing the number of contiguous subarrays that…
Checking your access…