题目:
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.
分析:
要求,移除具有n个元素的数组中所有指定的数字,返回删除后的数组长度。看似简单,其实也能体现一个人的编程水平。
解法1是优化后的,解法2是参照网上的STL解法,,记录下来。
代码:
解释一下STL的几个算法,都包含在algorithm中:
版权声明:本文为博主原创文章,未经博主允许不得转载。
去了不同的地方,看了不同的风景,知道了不同的事,