Reputation interview question

Mountain Array - LC Medium