title: How to find first common occurence in two stacks?
body: <p>I'm thinking the best route is to just pop off an element from first stack, hash it, then see if the same element in the second stack when popped is in the map. Is this the right track?</p>
  
  <p>Example:</p>
  
  <pre><code>stack1 = [1, 3, 4, 1, 2] 
  
  stack2 = [8, 7, 3, 0]
  </code></pre>
  
  <p>the first common occurrence would be 3.</p>
  
  <p>EDIT: I'm going to hash stack1 and then compare each element in stack2 to that hash. Thanks!</p>