3781. Maximum Score After Binary Swaps
You are given an integer array
numsof lengthnand a binary stringsof the same length.Initially, your score is 0. Each index
iwheres[i] = '1'contributesnums[i]to the score.You may perform any number of operations (including zero). In one operation, you may choose an index
isuch that0 <= i < n - 1, wheres[i] = '0', ands[i + 1] = '1', and swap these two characters.Return an integer denoting the maximum possible score you can achieve.
1 |
|