title: Find Kth or Nth Last Node from Linked List in Single Pass
body: <p>I'm trying to better understand and learn data structures along with Java with an online course. One of the problems we were presented with was <strong>'Find Kth or Nth Last Node from Linked List in Single Pass '</strong> I thought I had come to a solution only to watch the 'solution video' afterwards and see that my code was entirely different. Here is my code:</p>
  <pre><code>public int getKthFromTheEndConfused(int k) throws IndexOutOfBoundsException{
      if (k &lt;= size &amp;&amp; k &gt; 0) {
          int count = size;
          Node current = first;
          while (count != k) {
              count--;
              current = current.next;
          }
          return current.value;
      } else {
          throw new IndexOutOfBoundsException();
      }
  }
  </code></pre>
  <p>Now my question is... what exactly is a 'single pass'? Is it just only iterating through a list once? Is it only reading input once? Both? And also is my method 'single pass'? If it is, would you say this method would work for the given problem? Any feedback greatly appreciated, thank you!</p>