Created
May 14, 2015 10:44
-
-
Save stephen-maina/8d2e08e20b6a75d04485 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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