Skip to content

Commit 52a3ee2

Browse files
authored
Create 27-Remove-Element.c
Create the C solution as the same solution in the YouTube video "https://www.youtube.com/watch?v=Pcd1ii9P9ZI"
1 parent a68908e commit 52a3ee2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

c/27-Remove-Element.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
int removeElement(int* nums, int numsSize, int val){
2+
int k = 0;
3+
4+
for(int i = 0; i < numsSize; i++)
5+
{
6+
if(nums[i] != val)
7+
{
8+
nums[k] = nums[i];
9+
k++;
10+
}
11+
}
12+
13+
return k;
14+
}

0 commit comments

Comments
 (0)