Created
June 18, 2014 23:40
-
-
Save catsby/1f87b7fbfbd7da70de2f to your computer and use it in GitHub Desktop.
exercisms
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
package etl | |
import ( | |
"strings" | |
) | |
func Transform(input map[int][]string) map[string]int { | |
m := make(map[string]int) | |
for k, v := range input { | |
for _, o := range v { | |
m[strings.ToLower(o)] = k | |
} | |
} | |
return m | |
} |
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
class Hamming | |
def self.compute(first,second) | |
diffs = first.each_char.with_index.select do |c,i| | |
c != second[i] unless second[i].nil? | |
end | |
diffs.count | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment