# 1493. Longest Subarray of 1's After Deleting One Element

```python
class Solution:
    def longestSubarray(self, nums: List[int]) -> int:
        i = 0
        K = 1
        n = len(nums)
        res = 0
        for j in range(n):
            if nums[j] == 0:
                K-=1
            while i < n and K < 0:
                if nums[i] == 0:
                    K+=1
                i+=1
            res = max(res,j-i+1)
        return res - 1
```
