题解 | #草原牛群集合#
草原牛群集合
https://www.nowcoder.com/practice/6fc74519ff9c44288dbcec5db7345ded
class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param nums int整型vector * @param val int整型 * @return int整型 */ int remove_cows(vector<int>& nums, int val) { // write code here int count = 0; for(auto i:nums){ if(i!=val){ count++; } } return count; } };