AKUNA CAPITAL interview question

Implement algorithm within certain time complexity