### Problem Statement

Given an array of unsorted numbers and a target, remove all occurances of target from it. After removing target in-place return the new length of the array.

In-place: Do not use Extra Space.

### Example:

```Input: arr: [1, 4, 9, 2, 3, 4, 4, 10, 4], target: 4
Output: 5
Explanation: After removing all occurances of 4 from arr. The new length of the array will be 5 with [1, 9, 2, 3, 10].
```

### Code

```class Innoskrit {

public static int removeTarget(int arr[], int target) {
int unique = 0;

for(int duplicate = 0; duplicate < arr.length; duplicate++) {
if(arr[duplicate] != target) {
arr[unique] = arr[duplicate];
unique++;
}
}

return unique;
}

public static void main(String[] args) {

int arr[] = new int[] {1, 4, 9, 2, 3, 4, 4, 10, 4};
int target = 4;
int ans = Innoskrit.removeTarget(arr, target);
System.out.println(ans);

}
}```
```#include<bits/stdc++.h>
using namespace std;

class Innoskrit {

public:
static int removeTarget(vector<int> &arr, int target) {
int unique = 0;

for(int duplicate = 0; duplicate < arr.size(); duplicate++) {
if(arr[duplicate] != target) {
arr[unique] = arr[duplicate];
unique++;
}
}

return unique;
}
};

int main() {

vector<int> arr = {1, 4, 9, 2, 3, 4, 4, 10, 4};
int target = 4;
int ans = Innoskrit::removeTarget(arr, target);
cout << ans;
return 0;

}```
```class Innoskrit:

@staticmethod
def remove_target(arr, target):
unique = 0

for duplicate in range(0, len(arr)):
if arr[duplicate] != target:
arr[unique] = arr[duplicate]
unique += 1

return unique

if __name__ == '__main__':
arr = [1, 4, 9, 2, 3, 4, 4, 10, 4]
target = 4
ans = Innoskrit.remove_target(arr, target)
print(ans)```

`5`

### Time and Space Complexity

Time Complexity: O(N)

Space Complexity: O(1)