Skip to content

Commit

Permalink
Create 27-Remove-Element.c
Browse files Browse the repository at this point in the history
Create the C solution as the same solution in the YouTube video "https://www.youtube.com/watch?v=Pcd1ii9P9ZI"
  • Loading branch information
MHamiid authored Dec 22, 2022
1 parent a68908e commit 52a3ee2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions c/27-Remove-Element.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
int removeElement(int* nums, int numsSize, int val){
int k = 0;

for(int i = 0; i < numsSize; i++)
{
if(nums[i] != val)
{
nums[k] = nums[i];
k++;
}
}

return k;
}

0 comments on commit 52a3ee2

Please sign in to comment.