Skip to content

Instantly share code, notes, and snippets.

@edopelawi
Created June 6, 2015 03:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edopelawi/8ca310d5b5801ac47a6c to your computer and use it in GitHub Desktop.
Save edopelawi/8ca310d5b5801ac47a6c to your computer and use it in GitHub Desktop.
Academia-Style Code
public Integer delta(String x) {
HashMap<Character, Integer> map = new HashMap<Character, Integer>();
Integer delta = 0;
for (Character y : x.toCharArray()) {
Integer count = map.get(y);
count++;
map.put(y,count);
}
for (Character c : map.keySet()) {
Integer defcount = defmap.get(c);
Integer count = map.get(c);
delta += (defcount-count);
}
return delta;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment