------
## 最终结论
```python
def find_length(s, n):
    max_diff = 0
    current_diff = 0
    count_0 = 0
    count_1 = 0
    
    for char in s:
        if char == '0':
            count_0 += 1
        else:
            count_1 += 1
        
        current_diff = count_0 - count_1
        max_diff = max(max_diff, current_diff)
        
        # Reset counts if the current diff becomes negative (meaning more 1s than 0s)
        if current_diff < 0:
            count_0 = 0
            count_1 = 0
            
    return max_diff

# Test cases
assert find_length("11000010001", 11) == 6
assert find_length("10111", 5) == 1
assert find_length("11011101100101", 14) == 2 
```