Tap here to switch tabs
Problem
Submissions

Problem: Count Smaller Elements With Opposite Parity

Try to solve the Count Smaller Elements With Opposite Parity problem.

Statement

Given an integer array nums, return an array answer of the same length where answer[i] is the number of indices j such that:

  • j > i

  • nums[j] < nums[i]

  • nums[i] and nums[j] have opposite parities (one is even and the other is odd)

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Smaller Elements With Opposite Parity

Try to solve the Count Smaller Elements With Opposite Parity problem.

Statement

Given an integer array nums, return an array answer of the same length where answer[i] is the number of indices j such that:

  • j > i

  • nums[j] < nums[i]

  • nums[i] and nums[j] have opposite parities (one is even and the other is odd)

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤109\leq 10^9