Domanda di colloquio di Trexquant Investment

Asked a leetcode medium level question on arrays. Had to solve in python.