TuSimple interview question

leetcode problem and calculate complexity