2595. Number of Even and Odd Bits

You are given a

positiveinteger`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]`

.

1 | class Solution { |