Bitjini Interview Question

oops, basic algorithms