prefixB
and suffixA
of the same length as the input string s
.prefixB
.suffixA
.minDeletions
to a large number.prefixB[i]
and suffixA[i]
. Update minDeletions
with the minimum of its current value and this sum.minDeletions
as the result.