Arista Networks Interview Question

They show me code about counting bits in an integer and asked what it is doing, then another function doing the same and asked which one is better over other