leetle

Daily challenge for 2026-01-25

390. Count Alternating Parity Bits

Given an array of integers nums, count how many elements have a different parity (even/odd) than the element immediately preceding them. The first element is never counted as it has no predecessor.

Example:
Input: nums = [1, 2, 4, 5] Output: 2 (2 is even after 1 is odd, and 5 is odd after 4 is even).

Run this challenge interactively in Python or JavaScript when the app loads.