전체 글
27. Remove Element
class Solution { public: int removeElement(vector& nums, int val) { int k=0; vector index; for(auto iter=nums.begin();iter!=nums.end();iter++) { if(*iter!=val) { index.push_back(*iter); k++; } } nums=index; return k; } };
class Solution { public: int removeElement(vector& nums, int val) { int k=0; vector index; for(auto iter=nums.begin();iter!=nums.end();iter++) { if(*iter!=val) { index.push_back(*iter); k++; } } nums=index; return k; } };