AKUNA CAPITAL interview question

coding problem was one about heaps