LeetCode c++ 27. 移除元素

使用vector特別注意erase函數,使用迭代器時,刪除以後會自動指向下一個元素函數 當使用erase刪除時,這纔是刪除的正確方法code class Solution { public: int removeElement(vector<int>& nums, int val) { for(vector<int>::iterator iter=nums.begin();
相關文章
相關標籤/搜索