Advertisement
Guest User

Untitled

a guest
Dec 21st, 2014
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. public class Solution {
  2. public int removeElement(int[] A, int elem) {
  3. if(A.length == 0) return A.length;
  4. int index = 0;
  5. for(int i = 0; i < A.length; i++) {
  6. if(A[i] != elem) {
  7. A[index] = A[i];
  8. index++;
  9. }
  10. }
  11. return index;
  12. }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement