--- Day 3: Binary Diagnostic ---
or..
I've had enough trauma in my life without having to learn bitwise operators, ok...
Part 1
Python
I later realized I was doubling up on the "work" of maintaing the data since epsilon was just a mirrored gamma, I could have just flipped the bits.
Go
In my Go version of this solution, I did just flip the bits to get epsilon, but I still didn't use a bitwise operator to do it.
Someday I'll learn how to properly use bitwise not.
func flipstring(val string) (string, error) {
var out string
for _, x := range strings.Split(val, "") {
if x == "0" {
out += "1"
} else {
out += "0"
}
}
return out, nil
}
Part 2
Python
The change from the problem in part 1 to the problem in part 2 was interesting.
Python really felt like the right tool for this because of how fast it is to write loops with list comprehensions.
Go
I'm starting to get more concerned with the "boiler plate" feel of Go in these challenges, but I think that it's not fair to frame them against Python. Looking at some of these in comparison to my friend John's C# solutions, I don't feel as bad about writing so much.
<< - Table of Contents - >>