```
public class Solution {
public int MinSubArrayLen(int s, int[] nums) {
int sum = 0;
int min = int.MaxValue;
for (int i = 0; i < nums.Length - 1; i++){
if (nums[i] >= s) return 1;
sum = nums[i];
for (int j = i + 1; j < nums.Length; j++){
sum += nums[j] ;
if (sum >= s){
min = Math.Min(min, j - i + 1);
break;
}
}
}
return min == int.MaxValue ? 0 : min;
}
}
```