[LeetCode] Number of Even and Odd Bits

1 · · March 19, 2023, 3:30 a.m.
2595. Number of Even and Odd Bits You are given a positive integer n. Let even denote the number of even indices in the binary representation of n (0-indexed) with value 1. Let odd denote the number of odd indices in the binary representation of n (0-indexed) with value 1. Return an integer array answer where answer = [even, odd]. ...