Bitwise Interview Question

Pseudo codes, pattern logics, SQL queries