Clean Python 3, O(N) with sliding window [Fixed]
Make a targets list of all possible subarrays with their corresponding length.\nAnd then find its possible minimun pair by a premin list.\nTime: O(N)\nSpace: O(
Make a targets list of all possible subarrays with their corresponding length.\nAnd then find its possible minimun pair by a premin list.\nTime: `O(N)`\nSpace: `O(N)`\n```\nclass Solution:\n    def minSumOfLengths(self, arr: List[int], target: int) -> int:\n        i, window, targets = 0, 0, [float(\'inf\')] * len(arr)\n        for j, num in enumerate(arr):\n            window += num\n            while window > target:\n                window -= arr[i]\n                i += 1\n            if window == target: targets[j] = j - i + 1\n        premin, result = [float(\'inf\')] * len(arr), float(\'inf\')\n        for i, target in enumerate(targets):\n            if i - target >= 0: result = min(result, target + premin[i - target])\n            premin[i] = target if i == 0 else min(target, premin[i - 1])\n        return result if result < float(\'inf\') else -1\n```
[]