I need to find minimum subarray length whose sum is *greater or equal* to `k`. Array will have only positive numbers.

eg

> 
> Input: `target = 7`, `nums = [2,3,1,2,4,3]` Output: 2 Explanation: The
> subarray [4,3] has the minimal length under the problem constraint.
> 
> 
> 

In my code, for Input: `target = 7`, `nums = [2,3,1,2,4,3]`
I am getting answer as `3`, but the right answer is `2`. How to fix it?

```
public int minSubArrayLen(int target, int[] nums) {

        int arraySize = nums.length;
        int end = 0; // end of subarray
        int start = 0; // start of subarray
        int minArraySize = Integer.MAX_VALUE;
        int sum = 0;

        while (end < arraySize) {
            sum = sum + nums[end];
            if (sum == target) {
                minArraySize = Math.min(minArraySize, end - start + 1);
                end++;
            } else if (sum > target) {
                while (sum > target) {
                    sum = sum - nums[start];
                    start++;
                }

                  end++;

                if (sum == target)
                {
                  minArraySize  = Math.min(minArraySize, end - start +1);
                }

            } else if (sum < target) {
                end++;

            }
        }

        return minArraySize;

    }

```