BNP Paribas interview question

Brainteasers involving algorithmic and complexity analysis