2595. Number of Even and Odd Bits
You are given a positive integer
n.Let
evendenote the number of even indices in the binary representation ofn(0-indexed) with value1.Let
odddenote the number of odd indices in the binary representation ofn(0-indexed) with value1.Return an integer array
answerwhereanswer = [even, odd].
1 | class Solution { |