If you're getting a TLE...
Probably you\'re thinking that you\'re working with 2 separate rect sequences and check them this way:\n\nfor i in range(N):\n    for j in range(N):\n\nBUT\nact
Probably you\'re thinking that you\'re working with **2 separate rect sequences** and check them this way:\n```\nfor i in range(N):\n    for j in range(N):\n```\n**BUT**\nactually you\'re working with **1 sequence** and thus comparing `j < i` is just a repeated work.\n\nLet me draw it for you:\n\n![image](https://assets.leetcode.com/users/images/57c25704-cb45-4e21-a93e-4cb1d72473e3_1715035656.8936615.png)\n\nThe solution:\n```\nfor i in range(N):\n    for j in range(i + 1, N):\n```\n\nCheers!\nAnd don\'t forget to upvote ;)
[]