I hereby claim:
- I am ericdykstra on github.
- I am ericd (https://keybase.io/ericd) on keybase.
- I have a public key whose fingerprint is 0F12 55A0 3A2A C56E F189 219D E653 1EE6 9498 4DB9
To claim this, I am signing this object:
| def better_shuffle(array) | |
| shuffled_array = [] | |
| until array.length == 0 | |
| rand_num = rand(array.length - 1) | |
| shuffled_array << array.delete_at(rand_num) | |
| end | |
| return shuffled_array | |
| end |
| ## enumerable methods ## | |
| p [1,2,3,4,5].each { |x| x * 2 } == [] #put the output here to make it return true | |
| p [1,2,3,4,5].map { |x| x * 2 } == [] | |
| p [1,2,3,4,5].select { |x| x % 2 == 0 } == [] | |
| ## hashes ## | |
| hash = {1 => 2, [99,99] => "fifty", a: {b:"a"}} | |
| p 2 == hash[1] #example | |
| p "fifty" == hash | |
| p "a" == hash |
| def onehundred(arr) | |
| result = [] | |
| arr.each_with_index do |x,i| | |
| i_of_2nd = arr[i..arr.length].find_index(100-x) | |
| if i_of_2nd | |
| result << [x, 100-x] | |
| arr.delete_at(i_of_2nd) | |
| end | |
| end | |
| return result |
| <!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> |
I hereby claim:
To claim this, I am signing this object:
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.
| 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}, | |
| } |
| # 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(:*) |
| function exrun() { | |
| mix escript.build && ./${PWD##*/} | |
| } |
| % ... | |
| 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)]. |