# \*\*\*Longest Subarray of 1's After Deleting One Element (Leetcode 1493)

Problem Link: <https://leetcode.com/problems/longest-subarray-of-1s-after-deleting-one-element/>

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