
You are given a 0-indexed integer array nums of length n . The number of ways to partition nums is the number of pivot indices that satisfy both conditions:
1 <= pivot < n
nums[0] + nums[1] + ... + nums[pivot - 1] == nums[pivot] + nums[pivot + 1] + ... + nums[n - 1]
You are also given an integer k . You can choose to change the value of one element of nums to k , or to leave the array unchanged .
Return the maximum possible number of ways to partition nums to satisfy both conditions after changing at most one element .
n == nums.length2 <= n <= 10 ^5-10 ^5 <= k, nums[i] <= 10 ^5