You are given a nums of length n and an integer k.
You are allowed to choose at most one element in nums and replace its value with k. Alternatively, you may choose to leave the array unchanged.
A pivot index pivot defines a valid partition if pivot nums from index pivot nums from index pivot to n
Return the maximum number of valid partitions you can obtain after modifying at most one element.
Constraints:
n nums.length
n
k, nums[i]
You are given a nums of length n and an integer k.
You are allowed to choose at most one element in nums and replace its value with k. Alternatively, you may choose to leave the array unchanged.
A pivot index pivot defines a valid partition if pivot nums from index pivot nums from index pivot to n
Return the maximum number of valid partitions you can obtain after modifying at most one element.
Constraints:
n nums.length
n
k, nums[i]