I hereby claim:
- I am ericdykstra on github.
- I am ericd (https://keybase.io/ericd) on keybase.
- I have a public key ASAv966Qu1nq0p8ibkcTXgdP5DYqGCMXbNA-FMJWrNKEQQo
To claim this, I am signing this object:
def change_state(xstate, d) | |
directions = "NESW" | |
i = "NESW".index(xstate) | |
if d == "R" | |
directions[i+1] ? directions[i+1] : "N" | |
else | |
directions[i-1] ? directions[i-1] : "W" | |
end | |
end |
defmodule Day1 do | |
def main(file_path) do | |
file_path |> File.read! |> process |> IO.puts | |
end | |
def process(input) do | |
input | |
|> String.split(", ") | |
|> Enum.reduce(%{x: 0, y: 0, dir: "N"}, &reducer/2) | |
|> extract_answer |
I hereby claim:
To claim this, I am signing this object:
% ... | |
read_array(0,D) -> []; | |
read_array(N,D) -> | |
{ok, [X]} = io:fread("", D), | |
[X | read_array(N-1,D)]. | |
read_2darray(0,M,D) -> []; | |
read_2darray(N,M,D) -> | |
Q=read_array(M,D), | |
[Q | read_2darray(N-1,M,D)]. |
function exrun() { | |
mix escript.build && ./${PWD##*/} | |
} |
# uncomment for part 1 num_groups = 3 | |
# uncomment for part 2 num_groups = 4 | |
start = 1 | |
until answer = array.combination(start).select{|c| c.inject(:+) == (array.inject(:+) / num_groups)}.sort_by{|c| c.inject(:*)}.first | |
start += 1 | |
end | |
p answer.inject(:*) |
class Battle | |
SPELLS = { | |
"Magic Missile" => {cost: 53, damage: 4}, | |
"Drain" => {cost: 73, damage: 2, heal: 2}, | |
"Shield" => {cost: 113, timer: 6, effect: "armor", amount: 7}, | |
"Poison" => {cost: 173, timer: 6, effect: "poison", amount: 3}, | |
"Recharge" => {cost: 229, timer: 5, effect: "recharge", amount: 101}, | |
} |
You've just been hired by a SF tech company that is looking to expand operations into new cities. Your first task: launch Salt Lake City. To launch into a new city of this size, you need to hire a general manager, 3 salespeople, 2 customer support agents, an office manager, and a marketing manager. You have pulled together a list of all the potential employees for these 8 positions, as well as their salary requirement and a quantified amount of "impact" that they can bring your team.
Your goal is to fill all 8 positions for $350,000 or less with the employees that will maximize "impact".
Not challenging enough? 5500 candidates applied to the same 8 positions for the New York City office, and our budget here is $450,000. Maximize impact while staying under budget again with this group.
I hereby claim:
To claim this, I am signing this object:
<!doctype html> | |
<html> | |
<head> | |
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css"> | |
<link rel="stylesheet" href="main.css"> | |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800"> | |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900"> | |
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css"> | |
</head> |