Skip to content

Instantly share code, notes, and snippets.

@clarkdo
Created January 29, 2018 09:52
Show Gist options
  • Save clarkdo/cac6880c70ed245215859edb28fc3ccb to your computer and use it in GitHub Desktop.
Save clarkdo/cac6880c70ed245215859edb28fc3ccb to your computer and use it in GitHub Desktop.
import java.util.Set;
import java.util.HashSet;
// you can write to stdout for debugging purposes, e.g.
// System.out.println("this is a debug message");
class Solution {
public int solution(int[] A) {
Set<Integer> distincts = new HashSet<>();
for (int i: A) {
distincts.add(i);
}
return distincts.size();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment