REX interview question

A few algorithmic questions during tech/phone interview