Coding Ninjas problem help in approach

if for any unset bit in n there are odd set bits before it than A wins otherwise B wins.