Tap here to switch tabs
Problem
Submissions

Problem: Count Indices With Opposite Parity

Try to solve the Count Indices With Opposite Parity problem.

Statement

You are given an integer array nums.

For each index i, its score is defined as the number of indices j such that j >> i and nums[i] and nums[j] have opposite parities (that is, one element is even and the other is odd).

Return an array answer of the same length as nums, where answer[i] is the score of index i.

Constraints:

  • 1≤1 \leq nums.length ≤100\leq 100

  • 1≤1 \leq nums[i] ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Indices With Opposite Parity

Try to solve the Count Indices With Opposite Parity problem.

Statement

You are given an integer array nums.

For each index i, its score is defined as the number of indices j such that j >> i and nums[i] and nums[j] have opposite parities (that is, one element is even and the other is odd).

Return an array answer of the same length as nums, where answer[i] is the score of index i.

Constraints:

  • 1≤1 \leq nums.length ≤100\leq 100

  • 1≤1 \leq nums[i] ≤100\leq 100