title: Stack push and pop conceptual understanding
body: <p>So, I'm working on a programming puzzle and need some help to see what I'm missing.</p>
  
  <p>Here is the prompt:</p>
  
  <blockquote>
    <p>What are the contents of the stack after running the following algorithm? </p>
    
    <p>Given an array and an empty stack:</p>
    
    <ol>
    <li><p>Push the values of the array onto the stack until a -1 value is found. Do not push the -1. </p></li>
    <li><p>Pop the values in the stack until an even value is found or the stack is empty. The even value shouldn't be popped. </p></li>
    </ol>
    
    <p>Repeat steps 1 and 2 until the stack is full or the array is read completely. </p>
    
    <p>Type the contents of the stack from top to bottom, separated by a space, in the Answer box. If the stack is empty, enter a 0.</p>
    
    <p>For this problem, use an array = {10,1, 3, 2, 3, -1, 4, 5, 7}, and a stack size of 6.</p>
  </blockquote>
  
  <p>I honestly feel like this should be pretty easy but for some reason I'm missing something and continue to get it wrong.</p>
  
  <p>Here is my thought process: (stack from bottom to top)</p>
  
  <ol>
  <li>10 1 3 2 3</li>
  <li>10 1 3 2</li>
  <li>10 1 3 2 10 1</li>
  <li>10 1 3 2 10</li>
  <li>10 1 3 2 10 10</li>
  </ol>
  
  <p>Final from top to bottom: 10 10 2 3 1 10</p>
  
  <p>Is there something about stacks that I'm missing?
  Any ideas?</p>