Squarepoint Capital interview question

Live leetcode medium level question. Know how to analyze runtime