Google interview question

a monotoious related medium coding problem