Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Solution {
- public int removeElement(int[] A, int elem) {
- if(A.length == 0) return A.length;
- int index = 0;
- for(int i = 0; i < A.length; i++) {
- if(A[i] != elem) {
- A[index] = A[i];
- index++;
- }
- }
- return index;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement