IBM interview question

Two leetcode problems, using binary operations.