Tap here to switch tabs
Problem
Submissions

Problem: Count Indices With Opposite Parity

Count Indices With Opposite Parity asks you to score every position in an integer array by counting later elements with a different parity, then return all scores in an array.

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

Count Indices With Opposite Parity asks you to score every position in an integer array by counting later elements with a different parity, then return all scores in an array.

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