Practice Number of Sub-arrays With Odd Sum
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Given an array of integers arr, return the number of subarrays with an odd sum. Since the answer can be very large, return it modulo 10^9 + 7.
Source: Number of Sub-arrays With Odd Sum on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
arr = [1,3,5]
Output
4
# Example 2
Input
arr = [2,4,6]
Output
0
# Example 3
Input
arr = [1,2,3,4,5,6,7]
Output
16
Constraints
1 <= arr.length <= 10^5
1 <= arr[i] <= 100
Related LeetCode Problems
Practice more problems similar to Number of Sub-arrays With Odd Sum.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.