MCPcopy Create free account
hub / github.com/codedecks-in/LeetCode-Solutions / removeElement

Method removeElement

C++/remove-element.cpp:8–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6class Solution {
7public:
8 int removeElement(vector<int>& nums, int val) {
9 int slow=0;
10 int fast = 0;
11
12
13 while (fast < nums.size()){
14
15 if (nums[fast]!=val){nums[slow++]=nums[fast];}
16 fast++;
17
18 }
19
20 return slow;
21
22 }
23};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected