Broadridge interview question

Calculate subnets on the fly