AKUNA CAPITAL interview question

A standard coding problem on codepair