天天看点

LeetCode "Remove Element"

Since no order requirement, we can simply swap the target value to the last non-target-value in the array - if the last non-target-value is not behind the current index, we are done. I got 1A:

LeetCode "Remove Element"
LeetCode "Remove Element"

View Code