added a bitwise solution to Q1.1