NoRedInk ❖ We get a lot of applicants ❖ Roughly 75% of the candidates fail our “take home” ❖ Around 30% of the rest fail their first technical interview ❖ I see a lot of what doesn’t work
upper bound on algorithm efficiency ❖ Can be used for time or space ❖ Drops constants and non-dominant terms ❖ Adds independent work; multiplies dependent work ❖ Not just an academic curiosity! It can help you solve problems faster and easier!
55, 59] b = [17, 35, 39, 40, 55, 58, 60] i = 0 shared = b.each_with_object([ ]) do |n, array| while i < a.size && a[i] < n i += 1 end array << n if a[i] == n end p shared
55, 59] b = [17, 35, 39, 40, 55, 58, 60] i = 0 shared = b.each_with_object([ ]) do |n, array| while i < a.size && a[i] < n i += 1 end array << n if a[i] == n end p shared
55, 59] b = [17, 35, 39, 40, 55, 58, 60] i = 0 shared = b.each_with_object([ ]) do |n, array| while i < a.size && a[i] < n i += 1 end array << n if a[i] == n end p shared
i < 2 recursive(i - 2) + recursive(i - 1) end def memoized(i) cache = Hash.new { |hash, n| hash[n] = n < 2 ? n : hash[n - 2] + hash[n - 1] } cache[i] end def dynamic(i) return i if i < 2 a, b = 0, 1 (i - 2).times do a, b = b, a + b end a + b end end
i < 2 recursive(i - 2) + recursive(i - 1) end def memoized(i) cache = Hash.new { |hash, n| hash[n] = n < 2 ? n : hash[n - 2] + hash[n - 1] } cache[i] end def dynamic(i) return i if i < 2 a, b = 0, 1 (i - 2).times do a, b = b, a + b end a + b end end
i < 2 recursive(i - 2) + recursive(i - 1) end def memoized(i) cache = Hash.new { |hash, n| hash[n] = n < 2 ? n : hash[n - 2] + hash[n - 1] } cache[i] end def dynamic(i) return i if i < 2 a, b = 0, 1 (i - 2).times do a, b = b, a + b end a + b end end
i < 2 recursive(i - 2) + recursive(i - 1) end def memoized(i) cache = Hash.new { |hash, n| hash[n] = n < 2 ? n : hash[n - 2] + hash[n - 1] } cache[i] end def dynamic(i) return i if i < 2 a, b = 0, 1 (i - 2).times do a, b = b, a + b end a + b end end
Eight are the same weight and one is heavier. You are given a balance which tells you only wether the left side or right side is heavier. Find the heavy ball in just two uses of the scale.
a published gem ❖ It barely matters what it does ❖ The most important details are a strong README, clean code, tests, and documentation ❖ A small gem is fine
my tips every time ❖ That’s fine ❖ Interviews are hard for everyone and everyone makes mistakes ❖ Hit as many of the points we’ve discussed as you can ❖ Those you get will help