Leetcode Algorithms -- Remove Element
Remove Element (Easy)
Description
Given an array and a value, remove all instances of that value in place and return the new length.
The order of elements can be changed. It doesn’t matter what you leave beyond the new length.
Analysis
去除数组中的固定元素,注意的是要保证前ans个都没有所要求的那个数字。简单思维题
My Solution
1 | //C++ |