Skip to content

Instantly share code, notes, and snippets.

@stephen-maina
Created May 14, 2015 10:44
Show Gist options
  • Save stephen-maina/8d2e08e20b6a75d04485 to your computer and use it in GitHub Desktop.
Save stephen-maina/8d2e08e20b6a75d04485 to your computer and use it in GitHub Desktop.
import java.util.Set;
import java.util.HashSet;
class Solution {
public int solution(int[] A) {
// write your code in Java SE 8
Set<Integer> abs=new HashSet<Integer>();
for(int index=0;index<A.length;index++){
abs.add( Math.abs(A[index]));
}
return abs.size();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment