3952. Maximum Total Value of Covered Indices
You are given an integer array
numsof lengthnand a binary stringsof lengthn, wheres[i] == '1'means indexiinitially contains a token ands[i] == '0'means it does not.You may perform the following operation any number of times:
- Choose a token currently located at index
i, wherei > 0, such that this token has not been moved before.- Move this token from index
ito indexi - 1.An index is considered covered if it contains a token after all moves.
Return an integer denoting the maximum total value of
numsat the covered indices after optimally performing the operations.
1 | class Solution { |