Bitjini interview question

oops, basic algorithms