Bitwise Interview Question

logic for min to max * pattern