Spire Global Interview Question

Bit manipulation problem