Skip to content

Remove a given element from an array #69

Description

@SharedMocha

//https://www.interviewbit.com/problems/remove-duplicates-from-sorted-array/
public class Solution {
public int removeElement(ArrayList a, int b) {
int PA =0;
int PB =0;

 while(PA < a.size()){
if(a.get(PA) == b){
a.remove(PA);
}else{
PA++;
}
}
return a.size();
}

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions